@graspful/cli 0.1.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/dist/commands/create-brand.d.ts +8 -0
- package/dist/commands/create-brand.d.ts.map +1 -0
- package/dist/commands/create-brand.js +121 -0
- package/dist/commands/create-brand.js.map +1 -0
- package/dist/commands/create-course.d.ts +7 -0
- package/dist/commands/create-course.d.ts.map +1 -0
- package/dist/commands/create-course.js +98 -0
- package/dist/commands/create-course.js.map +1 -0
- package/dist/commands/describe.d.ts +3 -0
- package/dist/commands/describe.d.ts.map +1 -0
- package/dist/commands/describe.js +159 -0
- package/dist/commands/describe.js.map +1 -0
- package/dist/commands/fill-concept.d.ts +3 -0
- package/dist/commands/fill-concept.d.ts.map +1 -0
- package/dist/commands/fill-concept.js +116 -0
- package/dist/commands/fill-concept.js.map +1 -0
- package/dist/commands/import.d.ts +3 -0
- package/dist/commands/import.d.ts.map +1 -0
- package/dist/commands/import.js +116 -0
- package/dist/commands/import.js.map +1 -0
- package/dist/commands/login.d.ts +3 -0
- package/dist/commands/login.d.ts.map +1 -0
- package/dist/commands/login.js +81 -0
- package/dist/commands/login.js.map +1 -0
- package/dist/commands/publish.d.ts +3 -0
- package/dist/commands/publish.d.ts.map +1 -0
- package/dist/commands/publish.js +26 -0
- package/dist/commands/publish.js.map +1 -0
- package/dist/commands/review.d.ts +3 -0
- package/dist/commands/review.d.ts.map +1 -0
- package/dist/commands/review.js +421 -0
- package/dist/commands/review.js.map +1 -0
- package/dist/commands/validate.d.ts +3 -0
- package/dist/commands/validate.d.ts.map +1 -0
- package/dist/commands/validate.js +154 -0
- package/dist/commands/validate.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +37 -0
- package/dist/index.js.map +1 -0
- package/dist/lib/api-client.d.ts +10 -0
- package/dist/lib/api-client.d.ts.map +1 -0
- package/dist/lib/api-client.js +54 -0
- package/dist/lib/api-client.js.map +1 -0
- package/dist/lib/auth.d.ts +10 -0
- package/dist/lib/auth.d.ts.map +1 -0
- package/dist/lib/auth.js +81 -0
- package/dist/lib/auth.js.map +1 -0
- package/dist/lib/output.d.ts +6 -0
- package/dist/lib/output.d.ts.map +1 -0
- package/dist/lib/output.js +30 -0
- package/dist/lib/output.js.map +1 -0
- package/dist/quality-gate.d.ts +21 -0
- package/dist/quality-gate.d.ts.map +1 -0
- package/dist/quality-gate.js +16 -0
- package/dist/quality-gate.js.map +1 -0
- package/dist/schemas/academy-manifest.schema.d.ts +164 -0
- package/dist/schemas/academy-manifest.schema.d.ts.map +1 -0
- package/dist/schemas/academy-manifest.schema.js +70 -0
- package/dist/schemas/academy-manifest.schema.js.map +1 -0
- package/dist/schemas/brand-yaml.schema.d.ts +652 -0
- package/dist/schemas/brand-yaml.schema.d.ts.map +1 -0
- package/dist/schemas/brand-yaml.schema.js +97 -0
- package/dist/schemas/brand-yaml.schema.js.map +1 -0
- package/dist/schemas/course-yaml.schema.d.ts +1794 -0
- package/dist/schemas/course-yaml.schema.d.ts.map +1 -0
- package/dist/schemas/course-yaml.schema.js +161 -0
- package/dist/schemas/course-yaml.schema.js.map +1 -0
- package/dist/schemas/index.d.ts +4 -0
- package/dist/schemas/index.d.ts.map +1 -0
- package/dist/schemas/index.js +20 -0
- package/dist/schemas/index.js.map +1 -0
- package/package.json +31 -0
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.registerImportCommand = registerImportCommand;
|
|
37
|
+
const fs = __importStar(require("fs"));
|
|
38
|
+
const yaml = __importStar(require("js-yaml"));
|
|
39
|
+
const auth_1 = require("../lib/auth");
|
|
40
|
+
const api_client_1 = require("../lib/api-client");
|
|
41
|
+
const output_1 = require("../lib/output");
|
|
42
|
+
function detectFileType(data) {
|
|
43
|
+
if (typeof data !== 'object' || data === null)
|
|
44
|
+
return null;
|
|
45
|
+
const obj = data;
|
|
46
|
+
if ('course' in obj)
|
|
47
|
+
return 'course';
|
|
48
|
+
if ('brand' in obj)
|
|
49
|
+
return 'brand';
|
|
50
|
+
return null;
|
|
51
|
+
}
|
|
52
|
+
function registerImportCommand(program) {
|
|
53
|
+
program
|
|
54
|
+
.command('import <file>')
|
|
55
|
+
.description('Import a course or brand YAML into a Graspful instance')
|
|
56
|
+
.option('--org <slug>', 'Organization slug')
|
|
57
|
+
.option('--publish', 'Publish immediately (runs review gate)', false)
|
|
58
|
+
.action(async (file, opts) => {
|
|
59
|
+
if (!fs.existsSync(file)) {
|
|
60
|
+
(0, output_1.outputError)(`File not found: ${file}`);
|
|
61
|
+
process.exit(1);
|
|
62
|
+
}
|
|
63
|
+
const content = fs.readFileSync(file, 'utf-8');
|
|
64
|
+
let raw;
|
|
65
|
+
try {
|
|
66
|
+
raw = yaml.load(content);
|
|
67
|
+
}
|
|
68
|
+
catch (e) {
|
|
69
|
+
const msg = e instanceof Error ? e.message : String(e);
|
|
70
|
+
(0, output_1.outputError)(`YAML parse error: ${msg}`);
|
|
71
|
+
process.exit(1);
|
|
72
|
+
}
|
|
73
|
+
const fileType = detectFileType(raw);
|
|
74
|
+
if (!fileType) {
|
|
75
|
+
(0, output_1.outputError)('Could not detect file type. Expected top-level key: course or brand');
|
|
76
|
+
process.exit(1);
|
|
77
|
+
}
|
|
78
|
+
const creds = (0, auth_1.requireAuth)();
|
|
79
|
+
const api = new api_client_1.ApiClient(creds);
|
|
80
|
+
if (fileType === 'course') {
|
|
81
|
+
const orgSlug = opts.org;
|
|
82
|
+
if (!orgSlug) {
|
|
83
|
+
(0, output_1.outputError)('--org is required for course imports');
|
|
84
|
+
process.exit(1);
|
|
85
|
+
}
|
|
86
|
+
try {
|
|
87
|
+
const result = await api.post(`/api/v1/orgs/${orgSlug}/courses/import`, { yaml: content, publish: opts.publish });
|
|
88
|
+
if (opts.publish && result.reviewFailures && result.reviewFailures.length > 0) {
|
|
89
|
+
(0, output_1.output)({ ...result, status: 'imported_but_not_published' }, `Imported course ${result.courseId} but publish failed:\n${result.reviewFailures.map((f) => ` - ${f}`).join('\n')}`);
|
|
90
|
+
}
|
|
91
|
+
else {
|
|
92
|
+
(0, output_1.output)(result, `Imported course: ${result.courseId}\n URL: ${result.url}\n Published: ${result.published}`);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
catch (e) {
|
|
96
|
+
const msg = e instanceof Error ? e.message : String(e);
|
|
97
|
+
(0, output_1.outputError)(`Import failed: ${msg}`);
|
|
98
|
+
process.exit(1);
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
else {
|
|
102
|
+
// Brand import
|
|
103
|
+
try {
|
|
104
|
+
const brandData = raw;
|
|
105
|
+
const result = await api.post('/api/v1/brands', brandData);
|
|
106
|
+
(0, output_1.output)(result, `Imported brand: ${result.slug}\n Domain: ${result.domain}\n Verification: ${result.verificationStatus}`);
|
|
107
|
+
}
|
|
108
|
+
catch (e) {
|
|
109
|
+
const msg = e instanceof Error ? e.message : String(e);
|
|
110
|
+
(0, output_1.outputError)(`Brand import failed: ${msg}`);
|
|
111
|
+
process.exit(1);
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
//# sourceMappingURL=import.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"import.js","sourceRoot":"","sources":["../../src/commands/import.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiBA,sDAgFC;AAhGD,uCAAyB;AACzB,8CAAgC;AAChC,sCAA0C;AAC1C,kDAA8C;AAC9C,0CAAoD;AAIpD,SAAS,cAAc,CAAC,IAAa;IACnC,IAAI,OAAO,IAAI,KAAK,QAAQ,IAAI,IAAI,KAAK,IAAI;QAAE,OAAO,IAAI,CAAC;IAC3D,MAAM,GAAG,GAAG,IAA+B,CAAC;IAC5C,IAAI,QAAQ,IAAI,GAAG;QAAE,OAAO,QAAQ,CAAC;IACrC,IAAI,OAAO,IAAI,GAAG;QAAE,OAAO,OAAO,CAAC;IACnC,OAAO,IAAI,CAAC;AACd,CAAC;AAED,SAAgB,qBAAqB,CAAC,OAAgB;IACpD,OAAO;SACJ,OAAO,CAAC,eAAe,CAA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AM,SAAS,GAAG,GAA8B,CAAC;gBACjD,MAAM,MAAM,GAAG,MAAM,GAAG,CAAC,IAAI,CAC3B,gBAAgB,EAChB,SAAS,CACV,CAAC;gBAEF,IAAA,eAAM,EACJ,MAAM,EACN,mBAAmB,MAAM,CAAC,IAAI,eAAe,MAAM,CAAC,MAAM,qBAAqB,MAAM,CAAC,kBAAkB,EAAE,CAC3G,CAAC;YACJ,CAAC;YAAC,OAAO,CAAC,EAAE,CAAC;gBACX,MAAM,GAAG,GAAG,CAAC,YAAY,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;gBACvD,IAAA,oBAAW,EAAC,wBAAwB,GAAG,EAAE,CAAC,CAAC;gBAC3C,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;YAClB,CAAC;QACH,CAAC;IACH,CAAC,CAAC,CAAC;AACP,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"login.d.ts","sourceRoot":"","sources":["../../src/commands/login.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAepC,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,OAAO,QAqCpD"}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.registerLoginCommand = registerLoginCommand;
|
|
37
|
+
const readline = __importStar(require("readline"));
|
|
38
|
+
const auth_1 = require("../lib/auth");
|
|
39
|
+
const output_1 = require("../lib/output");
|
|
40
|
+
function prompt(question) {
|
|
41
|
+
const rl = readline.createInterface({ input: process.stdin, output: process.stdout });
|
|
42
|
+
return new Promise((resolve) => {
|
|
43
|
+
rl.question(question, (answer) => {
|
|
44
|
+
rl.close();
|
|
45
|
+
resolve(answer.trim());
|
|
46
|
+
});
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
function registerLoginCommand(program) {
|
|
50
|
+
program
|
|
51
|
+
.command('login')
|
|
52
|
+
.description('Authenticate with a Graspful instance')
|
|
53
|
+
.option('--api-url <url>', 'API base URL')
|
|
54
|
+
.option('--token <token>', 'API key or JWT token (skip interactive prompt)')
|
|
55
|
+
.action(async (opts) => {
|
|
56
|
+
const baseUrl = opts.apiUrl || (0, auth_1.getBaseUrl)();
|
|
57
|
+
let token = opts.token;
|
|
58
|
+
if (!token) {
|
|
59
|
+
if (!process.stdin.isTTY) {
|
|
60
|
+
// Read from piped stdin
|
|
61
|
+
const chunks = [];
|
|
62
|
+
for await (const chunk of process.stdin) {
|
|
63
|
+
chunks.push(chunk);
|
|
64
|
+
}
|
|
65
|
+
token = Buffer.concat(chunks).toString('utf-8').trim();
|
|
66
|
+
}
|
|
67
|
+
else {
|
|
68
|
+
console.log(`Authenticating with ${baseUrl}`);
|
|
69
|
+
console.log('Enter your API key or JWT token:');
|
|
70
|
+
token = await prompt('> ');
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
if (!token) {
|
|
74
|
+
(0, output_1.outputError)('No token provided');
|
|
75
|
+
process.exit(1);
|
|
76
|
+
}
|
|
77
|
+
(0, auth_1.saveCredentials)(token, baseUrl);
|
|
78
|
+
(0, output_1.output)({ authenticated: true, baseUrl }, `Authenticated. Credentials saved for ${baseUrl}`);
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
//# sourceMappingURL=login.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"login.js","sourceRoot":"","sources":["../../src/commands/login.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAeA,oDAqCC;AAnDD,mDAAqC;AACrC,sCAA0D;AAC1D,0CAAoD;AAEpD,SAAS,MAAM,CAAC,QAAgB;IAC9B,MAAM,EAAE,GAAG,QAAQ,CAAC,eAAe,CAAC,EAAE,KAAK,EAAE,OAAO,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;IACtF,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;QAC7B,EAAE,CAAC,QAAQ,CAAC,QAAQ,EAAE,CAAC,MAAM,EAA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OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC;QAED,IAAA,sBAAe,EAAC,KAAK,EAAE,OAAO,CAAC,CAAC;QAEhC,IAAA,eAAM,EACJ,EAAE,aAAa,EAAE,IAAI,EAAE,OAAO,EAAE,EAChC,wCAAwC,OAAO,EAAE,CAClD,CAAC;IACJ,CAAC,CAAC,CAAC;AACP,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"publish.d.ts","sourceRoot":"","sources":["../../src/commands/publish.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAKpC,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,OAAO,QAyBtD"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.registerPublishCommand = registerPublishCommand;
|
|
4
|
+
const auth_1 = require("../lib/auth");
|
|
5
|
+
const api_client_1 = require("../lib/api-client");
|
|
6
|
+
const output_1 = require("../lib/output");
|
|
7
|
+
function registerPublishCommand(program) {
|
|
8
|
+
program
|
|
9
|
+
.command('publish <courseId>')
|
|
10
|
+
.description('Publish a course (sets isPublished = true)')
|
|
11
|
+
.requiredOption('--org <slug>', 'Organization slug')
|
|
12
|
+
.action(async (courseId, opts) => {
|
|
13
|
+
const creds = (0, auth_1.requireAuth)();
|
|
14
|
+
const api = new api_client_1.ApiClient(creds);
|
|
15
|
+
try {
|
|
16
|
+
const result = await api.post(`/api/v1/orgs/${opts.org}/courses/${courseId}/publish`, {});
|
|
17
|
+
(0, output_1.output)(result, `Published course: ${result.courseId}`);
|
|
18
|
+
}
|
|
19
|
+
catch (e) {
|
|
20
|
+
const msg = e instanceof Error ? e.message : String(e);
|
|
21
|
+
(0, output_1.outputError)(`Publish failed: ${msg}`);
|
|
22
|
+
process.exit(1);
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=publish.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"publish.js","sourceRoot":"","sources":["../../src/commands/publish.ts"],"names":[],"mappings":";;AAKA,wDAyBC;AA7BD,sCAA0C;AAC1C,kDAA8C;AAC9C,0CAAoD;AAEpD,SAAgB,sBAAsB,CAAC,OAAgB;IACrD,OAAO;SACJ,OAAO,CAAC,oBAAoB,CAAC;SAC7B,WAAW,CAAC,4CAA4C,CAAC;SACzD,cAAc,CAAC,cAAc,EAAE,mBAAmB,CAAC;SACnD,MAAM,CAAC,KAAK,EAAE,QAAgB,EAAE,IAAqB,EAAE,EAAE;QACxD,MAAM,KAAK,GAAG,IAAA,kBAAW,GAAE,CAAC;QAC5B,MAAM,GAAG,GAAG,IAAI,sBAAS,CAAC,KAAK,CAAC,CAAC;QAEjC,IAAI,CAAC;YACH,MAAM,MAAM,GAAG,MAAM,GAAG,CAAC,IAAI,CAC3B,gBAAgB,IAAI,CAAC,GAAG,YAAY,QAAQ,UAAU,EACtD,EAAE,CACH,CAAC;YAEF,IAAA,eAAM,EACJ,MAAM,EACN,qBAAqB,MAAM,CAAC,QAAQ,EAAE,CACvC,CAAC;QACJ,CAAC;QAAC,OAAO,CAAC,EAAE,CAAC;YACX,MAAM,GAAG,GAAG,CAAC,YAAY,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;YACvD,IAAA,oBAAW,EAAC,mBAAmB,GAAG,EAAE,CAAC,CAAC;YACtC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC;IACH,CAAC,CAAC,CAAC;AACP,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"review.d.ts","sourceRoot":"","sources":["../../src/commands/review.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAuZpC,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,OAAO,QAyCrD"}
|