@transcend-io/cli 4.98.0 → 4.100.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/build/ai/TranscendAiPrompt.d.ts +3 -2
- package/build/ai/TranscendAiPrompt.d.ts.map +1 -1
- package/build/ai/TranscendAiPrompt.js +26 -5
- package/build/ai/TranscendAiPrompt.js.map +1 -1
- package/build/ai/getGitFilesThatChanged.d.ts +27 -0
- package/build/ai/getGitFilesThatChanged.d.ts.map +1 -0
- package/build/ai/getGitFilesThatChanged.js +52 -0
- package/build/ai/getGitFilesThatChanged.js.map +1 -0
- package/build/ai/index.d.ts +1 -0
- package/build/ai/index.d.ts.map +1 -1
- package/build/ai/index.js +1 -0
- package/build/ai/index.js.map +1 -1
- package/build/graphql/fetchAllAttributes.d.ts +2 -0
- package/build/graphql/fetchAllAttributes.d.ts.map +1 -1
- package/build/graphql/fetchAllAttributes.js.map +1 -1
- package/build/graphql/gqls/attribute.d.ts.map +1 -1
- package/build/graphql/gqls/attribute.js +1 -0
- package/build/graphql/gqls/attribute.js.map +1 -1
- package/build/tests/TranscendAiPrompt.test.js +34 -7
- package/build/tests/TranscendAiPrompt.test.js.map +1 -1
- package/build/tests/getGitFilesThatChanged.test.d.ts +2 -0
- package/build/tests/getGitFilesThatChanged.test.d.ts.map +1 -0
- package/build/tests/getGitFilesThatChanged.test.js +24 -0
- package/build/tests/getGitFilesThatChanged.test.js.map +1 -0
- package/build/tsbuildinfo +1 -1
- package/package.json +1 -1
|
@@ -4,6 +4,7 @@ import { Secret } from '@transcend-io/secret-value';
|
|
|
4
4
|
import * as t from 'io-ts';
|
|
5
5
|
import { HandlebarsInput } from './createHandlebarsWithHelpers';
|
|
6
6
|
export declare const EXPECTED_ATTRIBUTE_PREFIX = "attribute-";
|
|
7
|
+
export declare const BUSINESS_ENTITIES_PREFIX = "businessEntities-";
|
|
7
8
|
/**
|
|
8
9
|
* Define an AI prompt that can be loaded from Transcend
|
|
9
10
|
*/
|
|
@@ -37,11 +38,11 @@ export declare class TranscendAiPrompt<TParams extends ObjByString, TOutputCodec
|
|
|
37
38
|
* @param options - Additional options
|
|
38
39
|
* @returns A function that can be used to call the prompt
|
|
39
40
|
*/
|
|
40
|
-
fetchPromptFromTranscend({
|
|
41
|
+
fetchPromptFromTranscend({ fillTemplateFromInventory, transcendUrl, transcendApiKey, requireApproval, }: {
|
|
41
42
|
/** The Transcend API key */
|
|
42
43
|
transcendApiKey: string | Secret<string>;
|
|
43
44
|
/** When true, template in any attribute definitions in the prompt */
|
|
44
|
-
|
|
45
|
+
fillTemplateFromInventory?: boolean;
|
|
45
46
|
/** API of Transcend to call */
|
|
46
47
|
transcendUrl?: string;
|
|
47
48
|
/** When true, throw an error if the prompt is not approved */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TranscendAiPrompt.d.ts","sourceRoot":"","sources":["../../src/ai/TranscendAiPrompt.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAe,MAAM,0BAA0B,CAAC;AACpE,OAAO,KAAK,UAAU,MAAM,YAAY,CAAC;AAEzC,OAAO,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAC;AACpD,OAAO,KAAK,CAAC,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"TranscendAiPrompt.d.ts","sourceRoot":"","sources":["../../src/ai/TranscendAiPrompt.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAe,MAAM,0BAA0B,CAAC;AACpE,OAAO,KAAK,UAAU,MAAM,YAAY,CAAC;AAEzC,OAAO,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAC;AACpD,OAAO,KAAK,CAAC,MAAM,OAAO,CAAC;AAS3B,OAAO,EACL,eAAe,EAEhB,MAAM,+BAA+B,CAAC;AAIvC,eAAO,MAAM,yBAAyB,eAAe,CAAC;AACtD,eAAO,MAAM,wBAAwB,sBAAsB,CAAC;AAE5D;;GAEG;AACH,qBAAa,iBAAiB,CAC5B,OAAO,SAAS,WAAW,EAC3B,YAAY,SAAS,CAAC,CAAC,GAAG;IAE1B,sBAAsB;IACf,KAAK,EAAE,MAAM,CAAC;IAErB,wCAAwC;IACjC,KAAK,EAAE,YAAY,CAAC;IAE3B,0BAA0B;IACnB,UAAU,EAAE,OAAO,UAAU,CAAC;IAErC,qCAAqC;IAC9B,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAEpC;;;;OAIG;gBACS,EACV,KAAK,EACL,KAAK,EACL,cAAc,EACd,iBAAiB,GAClB,EAAE;QACD,mCAAmC;QACnC,KAAK,EAAE,MAAM,CAAC;QACd,mDAAmD;QACnD,KAAK,EAAE,YAAY,CAAC;QACpB,yCAAyC;QACzC,iBAAiB,CAAC,EAAE,eAAe,CAAC;QACpC,mFAAmF;QACnF,cAAc,CAAC,EAAE,MAAM,CAAC;KACzB;IASD;;;;;OAKG;IACG,wBAAwB,CAAC,EAC7B,yBAAgC,EAChC,YAAoC,EACpC,eAAe,EACf,eAAe,GAChB,EAAE;QACD,4BAA4B;QAC5B,eAAe,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC;QACzC,qEAAqE;QACrE,yBAAyB,CAAC,EAAE,OAAO,CAAC;QACpC,+BAA+B;QAC/B,YAAY,CAAC,EAAE,MAAM,CAAC;QACtB,8DAA8D;QAC9D,eAAe,CAAC,EAAE,OAAO,CAAC;KAC3B,GAAG,OAAO,CAAC,CAAC,MAAM,EAAE,OAAO,KAAK,MAAM,CAAC;IA4GxC;;;;;OAKG;IACH,eAAe,CAAC,QAAQ,EAAE,MAAM,GAAG,CAAC,CAAC,MAAM,CAAC,YAAY,CAAC;CAM1D"}
|
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.TranscendAiPrompt = exports.EXPECTED_ATTRIBUTE_PREFIX = void 0;
|
|
6
|
+
exports.TranscendAiPrompt = exports.BUSINESS_ENTITIES_PREFIX = exports.EXPECTED_ATTRIBUTE_PREFIX = void 0;
|
|
7
7
|
const type_utils_1 = require("@transcend-io/type-utils");
|
|
8
8
|
const privacy_types_1 = require("@transcend-io/privacy-types");
|
|
9
9
|
const fetchAssessments_1 = require("../graphql/fetchAssessments");
|
|
@@ -14,6 +14,7 @@ const createHandlebarsWithHelpers_1 = require("./createHandlebarsWithHelpers");
|
|
|
14
14
|
const camelCase_1 = __importDefault(require("lodash/camelCase"));
|
|
15
15
|
const keyBy_1 = __importDefault(require("lodash/keyBy"));
|
|
16
16
|
exports.EXPECTED_ATTRIBUTE_PREFIX = 'attribute-';
|
|
17
|
+
exports.BUSINESS_ENTITIES_PREFIX = 'businessEntities-';
|
|
17
18
|
/**
|
|
18
19
|
* Define an AI prompt that can be loaded from Transcend
|
|
19
20
|
*/
|
|
@@ -37,7 +38,7 @@ class TranscendAiPrompt {
|
|
|
37
38
|
* @param options - Additional options
|
|
38
39
|
* @returns A function that can be used to call the prompt
|
|
39
40
|
*/
|
|
40
|
-
async fetchPromptFromTranscend({
|
|
41
|
+
async fetchPromptFromTranscend({ fillTemplateFromInventory = true, transcendUrl = constants_1.DEFAULT_TRANSCEND_API, transcendApiKey, requireApproval, }) {
|
|
41
42
|
// construct GraphQL client
|
|
42
43
|
const client = (0, graphql_1.buildTranscendGraphQLClient)(transcendUrl, typeof transcendApiKey === 'string'
|
|
43
44
|
? transcendApiKey
|
|
@@ -58,8 +59,9 @@ class TranscendAiPrompt {
|
|
|
58
59
|
throw new Error(`Assessment "${this.title}" cannot be used because it's in status: "${assessment.status}"`);
|
|
59
60
|
}
|
|
60
61
|
// Template attributes into the template string
|
|
61
|
-
|
|
62
|
-
|
|
62
|
+
let extraParams = {};
|
|
63
|
+
// Template in attributes
|
|
64
|
+
if (fillTemplateFromInventory) {
|
|
63
65
|
// pull out the variables from the handlebar string
|
|
64
66
|
const schema = (0, getVariablesFromHandlebarsTemplate_1.getVariablesFromHandlebarsTemplate)(assessment.content);
|
|
65
67
|
// pull out the attributes to fetch
|
|
@@ -79,9 +81,28 @@ class TranscendAiPrompt {
|
|
|
79
81
|
if (!existingAttribute) {
|
|
80
82
|
throw new Error(`Failed to find attribute with name: "${attributeName}"`);
|
|
81
83
|
}
|
|
82
|
-
extraParams[attributeNameWithPrefix] = existingAttribute
|
|
84
|
+
extraParams[attributeNameWithPrefix] = existingAttribute;
|
|
83
85
|
});
|
|
84
86
|
}
|
|
87
|
+
// pull out the attributes to fetch
|
|
88
|
+
const businessEntitiesToFetch = Object.keys(schema).filter((key) => key.startsWith(exports.BUSINESS_ENTITIES_PREFIX));
|
|
89
|
+
// Fetch business entities if there are template variables to fill
|
|
90
|
+
if (businessEntitiesToFetch.length > 0) {
|
|
91
|
+
// TODO: https://transcend.height.app/T-29886 - only fetch business needed
|
|
92
|
+
// and find a way to template when multiple entities
|
|
93
|
+
const businessEntities = await (0, graphql_1.fetchAllBusinessEntities)(client);
|
|
94
|
+
const businessEntity = businessEntities[0];
|
|
95
|
+
if (businessEntity) {
|
|
96
|
+
extraParams = {
|
|
97
|
+
...extraParams,
|
|
98
|
+
...Object.entries(businessEntity).reduce((acc, [key, value]) => Object.assign(acc, { [`businessEntities-${key}`]: value }), {}),
|
|
99
|
+
};
|
|
100
|
+
extraParams.dataProtectionOfficerName =
|
|
101
|
+
businessEntity.dataProtectionOfficerName;
|
|
102
|
+
extraParams.dataProtectionOfficerEmail =
|
|
103
|
+
businessEntity.dataProtectionOfficerEmail;
|
|
104
|
+
}
|
|
105
|
+
}
|
|
85
106
|
}
|
|
86
107
|
// Return function that can compile template with attributes
|
|
87
108
|
// and provided parameters
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TranscendAiPrompt.js","sourceRoot":"","sources":["../../src/ai/TranscendAiPrompt.ts"],"names":[],"mappings":";;;;;;AAAA,yDAAoE;AAEp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G,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,EAC5D,EAAE,CACH;qBACF,CAAC;oBACF,WAAW,CAAC,yBAAyB;wBACnC,cAAc,CAAC,yBAAyB,CAAC;oBAC3C,WAAW,CAAC,0BAA0B;wBACpC,cAAc,CAAC,0BAA0B,CAAC;iBAC7C;aACF;SACF;QAED,4DAA4D;QAC5D,0BAA0B;QAC1B,OAAO,CAAC,MAAM,EAAE,EAAE,CAChB,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;YAC1C,qCAAqC;YACrC,WAAW,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;YACrC,GAAG,WAAW;YACd,GAAG,MAAM;SACV,CAAC,CAAC;IACP,CAAC;IAED;;;;;OAKG;IACH,eAAe,CAAC,QAAgB;QAC9B,MAAM,SAAS,GAAG,IAAI,CAAC,mBAAmB;YACxC,CAAC,CAAC,CAAC,IAAI,CAAC,mBAAmB,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,QAAQ;YAChE,CAAC,CAAC,QAAQ,CAAC;QACb,OAAO,IAAA,wBAAW,EAAC,IAAI,CAAC,KAAK,EAAE,SAAS,CAAC,CAAC;IAC5C,CAAC;CACF;AAxLD,8CAwLC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Function thats gets the git files that have changed
|
|
3
|
+
* and returns the code
|
|
4
|
+
*
|
|
5
|
+
* @param options - Options
|
|
6
|
+
* @returns Changes files and diffs
|
|
7
|
+
*/
|
|
8
|
+
export declare function getGitFilesThatChanged({ baseBranch, rootDirectory, githubRepo, excludedGlob, fileBlockList, }: {
|
|
9
|
+
/** Base branch */
|
|
10
|
+
baseBranch: string;
|
|
11
|
+
/** Github repo name */
|
|
12
|
+
githubRepo: string;
|
|
13
|
+
/** Root directory */
|
|
14
|
+
rootDirectory: string;
|
|
15
|
+
/** A glob that excludes files */
|
|
16
|
+
excludedGlob?: string[];
|
|
17
|
+
/** Block list of files to not process */
|
|
18
|
+
fileBlockList?: string[];
|
|
19
|
+
}): {
|
|
20
|
+
/** The list of files that changed */
|
|
21
|
+
changedFiles: string[];
|
|
22
|
+
/** Mapping from file name to file contents that changed */
|
|
23
|
+
fileDiffs: {
|
|
24
|
+
[k in string]: string;
|
|
25
|
+
};
|
|
26
|
+
};
|
|
27
|
+
//# sourceMappingURL=getGitFilesThatChanged.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getGitFilesThatChanged.d.ts","sourceRoot":"","sources":["../../src/ai/getGitFilesThatChanged.ts"],"names":[],"mappings":"AAIA;;;;;;GAMG;AACH,wBAAgB,sBAAsB,CAAC,EACrC,UAAU,EACV,aAAa,EACb,UAAU,EACV,YAAiB,EACjB,aAAkB,GACnB,EAAE;IACD,kBAAkB;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,uBAAuB;IACvB,UAAU,EAAE,MAAM,CAAC;IACnB,qBAAqB;IACrB,aAAa,EAAE,MAAM,CAAC;IACtB,iCAAiC;IACjC,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;IACxB,yCAAyC;IACzC,aAAa,CAAC,EAAE,MAAM,EAAE,CAAC;CAC1B,GAAG;IACF,qCAAqC;IACrC,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,2DAA2D;IAC3D,SAAS,EAAE;SAAG,CAAC,IAAI,MAAM,GAAG,MAAM;KAAE,CAAC;CACtC,CAoDA"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.getGitFilesThatChanged = void 0;
|
|
7
|
+
const difference_1 = __importDefault(require("lodash/difference"));
|
|
8
|
+
const fast_glob_1 = __importDefault(require("fast-glob"));
|
|
9
|
+
const child_process_1 = require("child_process");
|
|
10
|
+
/**
|
|
11
|
+
* Function thats gets the git files that have changed
|
|
12
|
+
* and returns the code
|
|
13
|
+
*
|
|
14
|
+
* @param options - Options
|
|
15
|
+
* @returns Changes files and diffs
|
|
16
|
+
*/
|
|
17
|
+
function getGitFilesThatChanged({ baseBranch, rootDirectory, githubRepo, excludedGlob = [], fileBlockList = [], }) {
|
|
18
|
+
// Pull base branch
|
|
19
|
+
(0, child_process_1.execSync)(`git fetch origin ${baseBranch}`);
|
|
20
|
+
// Latest commit on base branch. If we are on the base branch, we take the prior commit
|
|
21
|
+
const latestBasedCommit = (0, child_process_1.execSync)(`git ls-remote ${githubRepo} "refs/heads/${baseBranch}" | cut -f 1`, { encoding: 'utf-8' }).split('\n')[0];
|
|
22
|
+
// This commit
|
|
23
|
+
const latestThisCommit = (0, child_process_1.execSync)('git rev-parse HEAD', {
|
|
24
|
+
encoding: 'utf-8',
|
|
25
|
+
}).split('\n')[0];
|
|
26
|
+
// Ensure commits are present
|
|
27
|
+
if (!latestBasedCommit || !latestThisCommit) {
|
|
28
|
+
throw new Error('FAILED TO FIND COMMIT RANGE');
|
|
29
|
+
}
|
|
30
|
+
// Get the diff between the given branch and base branch
|
|
31
|
+
const diff = (0, child_process_1.execSync)(`git fetch && git diff --name-only "${baseBranch || latestBasedCommit}...${latestThisCommit}" -- ${rootDirectory}`, { encoding: 'utf-8' });
|
|
32
|
+
// Filter out block list
|
|
33
|
+
const changedFiles = (0, difference_1.default)(diff.split('\n').filter((f) => f), fileBlockList);
|
|
34
|
+
// Filter out globs
|
|
35
|
+
const filteredChanges = excludedGlob.length > 0
|
|
36
|
+
? fast_glob_1.default.sync(changedFiles, { ignore: excludedGlob })
|
|
37
|
+
: changedFiles;
|
|
38
|
+
// Get the contents of only the changed files
|
|
39
|
+
const fileDiffs = {};
|
|
40
|
+
filteredChanges.forEach((file) => {
|
|
41
|
+
const contents = (0, child_process_1.execSync)(`git show ${latestThisCommit}:${file}`, {
|
|
42
|
+
encoding: 'utf-8',
|
|
43
|
+
});
|
|
44
|
+
fileDiffs[file] = contents;
|
|
45
|
+
});
|
|
46
|
+
return {
|
|
47
|
+
changedFiles,
|
|
48
|
+
fileDiffs,
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
exports.getGitFilesThatChanged = getGitFilesThatChanged;
|
|
52
|
+
//# sourceMappingURL=getGitFilesThatChanged.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getGitFilesThatChanged.js","sourceRoot":"","sources":["../../src/ai/getGitFilesThatChanged.ts"],"names":[],"mappings":";;;;;;AAAA,mEAA2C;AAC3C,0DAAiC;AACjC,iDAAyC;AAEzC;;;;;;GAMG;AACH,SAAgB,sBAAsB,CAAC,EACrC,UAAU,EACV,aAAa,EACb,UAAU,EACV,YAAY,GAAG,EAAE,EACjB,aAAa,GAAG,EAAE,GAYnB;IAMC,mBAAmB;IACnB,IAAA,wBAAQ,EAAC,oBAAoB,UAAU,EAAE,CAAC,CAAC;IAE3C,uFAAuF;IACvF,MAAM,iBAAiB,GAAG,IAAA,wBAAQ,EAChC,iBAAiB,UAAU,gBAAgB,UAAU,cAAc,EACnE,EAAE,QAAQ,EAAE,OAAO,EAAE,CACtB,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;IAEjB,cAAc;IACd,MAAM,gBAAgB,GAAG,IAAA,wBAAQ,EAAC,oBAAoB,EAAE;QACtD,QAAQ,EAAE,OAAO;KAClB,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;IAElB,6BAA6B;IAC7B,IAAI,CAAC,iBAAiB,IAAI,CAAC,gBAAgB,EAAE;QAC3C,MAAM,IAAI,KAAK,CAAC,6BAA6B,CAAC,CAAC;KAChD;IAED,wDAAwD;IACxD,MAAM,IAAI,GAAG,IAAA,wBAAQ,EACnB,sCACE,UAAU,IAAI,iBAChB,MAAM,gBAAgB,QAAQ,aAAa,EAAE,EAC7C,EAAE,QAAQ,EAAE,OAAO,EAAE,CACtB,CAAC;IAEF,wBAAwB;IACxB,MAAM,YAAY,GAAG,IAAA,oBAAU,EAC7B,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EACjC,aAAa,CACd,CAAC;IAEF,mBAAmB;IACnB,MAAM,eAAe,GACnB,YAAY,CAAC,MAAM,GAAG,CAAC;QACrB,CAAC,CAAC,mBAAQ,CAAC,IAAI,CAAC,YAAY,EAAE,EAAE,MAAM,EAAE,YAAY,EAAE,CAAC;QACvD,CAAC,CAAC,YAAY,CAAC;IAEnB,6CAA6C;IAC7C,MAAM,SAAS,GAA8B,EAAE,CAAC;IAChD,eAAe,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE;QAC/B,MAAM,QAAQ,GAAG,IAAA,wBAAQ,EAAC,YAAY,gBAAgB,IAAI,IAAI,EAAE,EAAE;YAChE,QAAQ,EAAE,OAAO;SAClB,CAAC,CAAC;QACH,SAAS,CAAC,IAAI,CAAC,GAAG,QAAQ,CAAC;IAC7B,CAAC,CAAC,CAAC;IACH,OAAO;QACL,YAAY;QACZ,SAAS;KACV,CAAC;AACJ,CAAC;AA1ED,wDA0EC"}
|
package/build/ai/index.d.ts
CHANGED
package/build/ai/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/ai/index.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,QAAQ,KAAQ,CAAC;AAE9B,cAAc,qBAAqB,CAAC;AACpC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,eAAe,CAAC;AAC9B,cAAc,iCAAiC,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/ai/index.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,QAAQ,KAAQ,CAAC;AAE9B,cAAc,qBAAqB,CAAC;AACpC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,eAAe,CAAC;AAC9B,cAAc,iCAAiC,CAAC;AAChD,cAAc,0BAA0B,CAAC"}
|
package/build/ai/index.js
CHANGED
|
@@ -21,4 +21,5 @@ __exportStar(require("./TranscendAiPrompt"), exports);
|
|
|
21
21
|
__exportStar(require("./createHandlebarsWithHelpers"), exports);
|
|
22
22
|
__exportStar(require("./removeLinks"), exports);
|
|
23
23
|
__exportStar(require("./filterNullishValuesFromObject"), exports);
|
|
24
|
+
__exportStar(require("./getGitFilesThatChanged"), exports);
|
|
24
25
|
//# sourceMappingURL=index.js.map
|
package/build/ai/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/ai/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,MAAM,EAAE,KAAK,EAAE,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;AAEzB,QAAA,QAAQ,GAAG,KAAK,CAAC;AAE9B,sDAAoC;AACpC,gEAA8C;AAC9C,gDAA8B;AAC9B,kEAAgD"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/ai/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,MAAM,EAAE,KAAK,EAAE,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;AAEzB,QAAA,QAAQ,GAAG,KAAK,CAAC;AAE9B,sDAAoC;AACpC,gEAA8C;AAC9C,gDAA8B;AAC9B,kEAAgD;AAChD,2DAAyC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fetchAllAttributes.d.ts","sourceRoot":"","sources":["../../src/graphql/fetchAllAttributes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAKhD,OAAO,EAAE,gBAAgB,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C,MAAM,EAAE,aAAa,GACpB,OAAO,CAAC,SAAS,EAAE,CAAC,CAqCtB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fetchAllAttributes.js","sourceRoot":"","sources":["../../src/graphql/fetchAllAttributes.ts"],"names":[],"mappings":";;;;;;AACA,iCAAsD;AAEtD,sCAAmC;AACnC,oDAA4B;AAC5B,+DAA+D;AAC/D,6DAA0D;
|
|
1
|
+
{"version":3,"file":"fetchAllAttributes.js","sourceRoot":"","sources":["../../src/graphql/fetchAllAttributes.ts"],"names":[],"mappings":";;;;;;AACA,iCAAsD;AAEtD,sCAAmC;AACnC,oDAA4B;AAC5B,+DAA+D;AAC/D,6DAA0D;AA6C1D,MAAM,SAAS,GAAG,GAAG,CAAC;AAEtB;;;;;;GAMG;AACI,KAAK,UAAU,uBAAuB,CAC3C,MAAqB,EACrB,cAAsB;IAEtB,eAAM,CAAC,IAAI,CACT,gBAAM,CAAC,OAAO,CAAC,qCAAqC,cAAc,KAAK,CAAC,CACzE,CAAC;IACF,MAAM,eAAe,GAAqB,EAAE,CAAC;IAC7C,IAAI,MAAM,GAAG,CAAC,CAAC;IAEf,WAAW;IACX,IAAI,cAAc,GAAG,KAAK,CAAC;IAC3B,GAAG;QACD,MAAM,EACJ,eAAe,EAAE,EAAE,KAAK,EAAE;QAC1B,4CAA4C;UAC7C,GAAG,MAAM,IAAA,uCAAkB,EAMzB,MAAM,EAAE,uBAAgB,EAAE;YAC3B,KAAK,EAAE,SAAS;YAChB,MAAM;YACN,cAAc;SACf,CAAC,CAAC;QACH,eAAe,CAAC,IAAI,CAAC,GAAG,KAAK,CAAC,CAAC;QAC/B,MAAM,IAAI,SAAS,CAAC;QACpB,cAAc,GAAG,KAAK,CAAC,MAAM,KAAK,SAAS,CAAC;KAC7C,QAAQ,cAAc,EAAE;IAEzB,OAAO,eAAe,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAA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AC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC;AACjE,CAAC;AAvCD,gDAuCC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"attribute.d.ts","sourceRoot":"","sources":["../../../src/graphql/gqls/attribute.ts"],"names":[],"mappings":"AAqBA,eAAO,MAAM,UAAU,QAatB,CAAC;AAEF,eAAO,MAAM,uBAAuB,QAQnC,CAAC;AAGF,eAAO,MAAM,gBAAgB,
|
|
1
|
+
{"version":3,"file":"attribute.d.ts","sourceRoot":"","sources":["../../../src/graphql/gqls/attribute.ts"],"names":[],"mappings":"AAqBA,eAAO,MAAM,UAAU,QAatB,CAAC;AAEF,eAAO,MAAM,uBAAuB,QAQnC,CAAC;AAGF,eAAO,MAAM,gBAAgB,QAsB5B,CAAC;AAEF,eAAO,MAAM,gBAAgB,QAqB5B,CAAC;AAEF,eAAO,MAAM,gBAAgB,QAmB5B,CAAC;AAEF,eAAO,MAAM,uBAAuB,QAQnC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"attribute.js","sourceRoot":"","sources":["../../../src/graphql/gqls/attribute.ts"],"names":[],"mappings":";;;AAAA,qDAAsC;AACtC,+DAAsE;AAEtE,+FAA+F;AAC/F,MAAM,sBAAsB,GAAG,MAAM,CAAC,MAAM,CAAC,+CAA2B,CAAC;KACtE,GAAG,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,QAAQ,SAAS,WAAW,CAAC;KAChD,IAAI,CAAC,IAAI,CAAC,CAAC;AACd,MAAM,mBAAmB,GAAG,MAAM,CAAC,MAAM,CAAC,+CAA2B,CAAC;KACnE,GAAG,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,WAAW,SAAS,EAAE,CAAC;KAC1C,IAAI,CAAC,IAAI,CAAC,CAAC;AACd,MAAM,gBAAgB,GAAG,MAAM,CAAC,MAAM,CAAC,+CAA2B,CAAC;KAChE,GAAG,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,W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AA2B,CAAC;KACvE,GAAG,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,QAAQ,SAAS,WAAW,CAAC;KAChD,IAAI,CAAC,IAAI,CAAC,CAAC;AAEd,kEAAkE;AAClE,sEAAsE;AACtE,4BAA4B;AAC5B,2BAA2B;AACd,QAAA,UAAU,GAAG,IAAA,qBAAG,EAAA;;;;;;;UAOnB,mBAAmB;;;;;;CAM5B,CAAC;AAEW,QAAA,uBAAuB,GAAG,IAAA,qBAAG,EAAA;;;;;;;;CAQzC,CAAC;AAEF,kEAAkE;AACrD,QAAA,gBAAgB,GAAG,IAAA,qBAAG,EAAA;;;;;;;;;;;;;;;;;;;;;;CAsBlC,CAAC;AAEW,QAAA,gBAAgB,GAAG,IAAA,qBAAG,EAAA;;;;;EAKjC,uBAAuB;;;;;;;EAOvB,gBAAgB;;;;;;;;;CASjB,CAAC;AAEW,QAAA,gBAAgB,GAAG,IAAA,qBAAG,EAAA;;;;EAIjC,sBAAsB;;;;;;EAMtB,gBAAgB;;;;;;;;;CASjB,CAAC;AAEW,QAAA,uBAAuB,GAAG,IAAA,qBAAG,EAAA;;;;;;;;CAQzC,CAAC"}
|
|
@@ -26,7 +26,13 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
26
26
|
const chai_1 = require("chai");
|
|
27
27
|
const t = __importStar(require("io-ts"));
|
|
28
28
|
const TranscendAiPrompt_1 = require("../ai/TranscendAiPrompt");
|
|
29
|
-
|
|
29
|
+
describe('TranscendAiPrompt', () => {
|
|
30
|
+
const aiPrompt = new TranscendAiPrompt_1.TranscendAiPrompt({
|
|
31
|
+
title: 'test',
|
|
32
|
+
codec: t.array(t.string),
|
|
33
|
+
extractFromTag: 'json',
|
|
34
|
+
});
|
|
35
|
+
const TEST_DATA = `
|
|
30
36
|
Unfortunately the sample dataset provided does not contain enough information to determine who is most important.
|
|
31
37
|
However, here is a JSON string list of fields that could be useful for answering such a question if more data were available:
|
|
32
38
|
<json>
|
|
@@ -34,12 +40,6 @@ However, here is a JSON string list of fields that could be useful for answering
|
|
|
34
40
|
</json>
|
|
35
41
|
These fields like name, title, department, salary, and tenure co
|
|
36
42
|
`;
|
|
37
|
-
describe('TranscendAiPrompt', () => {
|
|
38
|
-
const aiPrompt = new TranscendAiPrompt_1.TranscendAiPrompt({
|
|
39
|
-
title: 'test',
|
|
40
|
-
codec: t.array(t.string),
|
|
41
|
-
extractFromTag: 'json',
|
|
42
|
-
});
|
|
43
43
|
it('should remove links', () => {
|
|
44
44
|
(0, chai_1.expect)(aiPrompt.parseAiResponse(TEST_DATA)).to.deep.equal([
|
|
45
45
|
'Name',
|
|
@@ -49,5 +49,32 @@ describe('TranscendAiPrompt', () => {
|
|
|
49
49
|
'Tenure',
|
|
50
50
|
]);
|
|
51
51
|
});
|
|
52
|
+
const TEST2_DATA = `
|
|
53
|
+
<json>
|
|
54
|
+
{
|
|
55
|
+
"title": "Ai usage of cli should not require assessment template title",
|
|
56
|
+
"description": "The note indicates that the AI usage of the CLI should not require an assessment template title.",
|
|
57
|
+
"actionItem": "Update CLI to not require template title when AI is using it.",
|
|
58
|
+
"type": "Feature Request",
|
|
59
|
+
"priority": "P2",
|
|
60
|
+
"taskForm": "User Story"
|
|
61
|
+
}
|
|
62
|
+
</json>
|
|
63
|
+
`;
|
|
64
|
+
const aiPrompt2 = new TranscendAiPrompt_1.TranscendAiPrompt({
|
|
65
|
+
title: 'test',
|
|
66
|
+
codec: t.record(t.string, t.string),
|
|
67
|
+
extractFromTag: 'json',
|
|
68
|
+
});
|
|
69
|
+
it('should remove links', () => {
|
|
70
|
+
(0, chai_1.expect)(aiPrompt2.parseAiResponse(TEST2_DATA)).to.deep.equal({
|
|
71
|
+
title: 'Ai usage of cli should not require assessment template title',
|
|
72
|
+
description: 'The note indicates that the AI usage of the CLI should not require an assessment template title.',
|
|
73
|
+
actionItem: 'Update CLI to not require template title when AI is using it.',
|
|
74
|
+
type: 'Feature Request',
|
|
75
|
+
priority: 'P2',
|
|
76
|
+
taskForm: 'User Story',
|
|
77
|
+
});
|
|
78
|
+
});
|
|
52
79
|
});
|
|
53
80
|
//# sourceMappingURL=TranscendAiPrompt.test.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TranscendAiPrompt.test.js","sourceRoot":"","sources":["../../src/tests/TranscendAiPrompt.test.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+BAA8B;AAC9B,yCAA2B;AAC3B,+DAA4D;AAE5D,
|
|
1
|
+
{"version":3,"file":"TranscendAiPrompt.test.js","sourceRoot":"","sources":["../../src/tests/TranscendAiPrompt.test.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+BAA8B;AAC9B,yCAA2B;AAC3B,+DAA4D;AAE5D,QAAQ,CAAC,mBAAmB,EAAE,GAAG,EAAE;IACjC,MAAM,QAAQ,GAAG,IAAI,qCAAiB,CAAC;QACrC,KAAK,EAAE,MAAM;QACb,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC;QACxB,cAAc,EAAE,MAAM;KACvB,CAAC,CAAC;IAEH,MAAM,SAAS,GAAG;;;;;;;CAOnB,CAAC;IAEA,EAAE,CAAC,qBAAqB,EAAE,GAAG,EAAE;QAC7B,IAAA,aAAM,EAAC,QAAQ,CAAC,eAAe,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC;YACxD,MAAM;YACN,OAAO;YACP,YAAY;YACZ,QAAQ;YACR,QAAQ;SACT,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,MAAM,UAAU,GAAG;;;;;;;;;;;GAWlB,CAAC;IAEF,MAAM,SAAS,GAAG,IAAI,qCAAiB,CAAC;QACtC,KAAK,EAAE,MAAM;QACb,KAAK,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,MAAM,CAAC;QACnC,cAAc,EAAE,MAAM;KACvB,CAAC,CAAC;IAEH,EAAE,CAAC,qBAAqB,EAAE,GAAG,EAAE;QAC7B,IAAA,aAAM,EAAC,SAAS,CAAC,eAAe,CAAC,UAAU,CAAC,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC;YAC1D,KAAK,EAAE,8DAA8D;YACrE,WAAW,EACT,kGAAkG;YACpG,UAAU,EACR,+DAA+D;YACjE,IAAI,EAAE,iBAAiB;YACvB,QAAQ,EAAE,IAAI;YACd,QAAQ,EAAE,YAAY;SACvB,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getGitFilesThatChanged.test.d.ts","sourceRoot":"","sources":["../../src/tests/getGitFilesThatChanged.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const chai_1 = require("chai");
|
|
4
|
+
const getGitFilesThatChanged_1 = require("../ai/getGitFilesThatChanged");
|
|
5
|
+
const path_1 = require("path");
|
|
6
|
+
// not easy to test this but can uncomment to run against current commit
|
|
7
|
+
describe.skip('getGitFilesThatChanged', () => {
|
|
8
|
+
it('should remove links', () => {
|
|
9
|
+
(0, chai_1.expect)((0, getGitFilesThatChanged_1.getGitFilesThatChanged)({
|
|
10
|
+
baseBranch: 'main',
|
|
11
|
+
githubRepo: 'https://github.com/transcend-io/cli.git',
|
|
12
|
+
rootDirectory: (0, path_1.join)(__dirname, '../../'),
|
|
13
|
+
})).to.deep.equal({
|
|
14
|
+
changedFiles: [
|
|
15
|
+
'package.json',
|
|
16
|
+
'src/ai/TranscendAiPrompt.ts',
|
|
17
|
+
'src/cli-analyze-pull-request.ts',
|
|
18
|
+
'src/tests/TranscendAiPrompt.test.ts',
|
|
19
|
+
],
|
|
20
|
+
fileDiffs: {},
|
|
21
|
+
});
|
|
22
|
+
});
|
|
23
|
+
});
|
|
24
|
+
//# sourceMappingURL=getGitFilesThatChanged.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getGitFilesThatChanged.test.js","sourceRoot":"","sources":["../../src/tests/getGitFilesThatChanged.test.ts"],"names":[],"mappings":";;AAAA,+BAA8B;AAE9B,yEAAsE;AACtE,+BAA4B;AAE5B,wEAAwE;AACxE,QAAQ,CAAC,IAAI,CAAC,wBAAwB,EAAE,GAAG,EAAE;IAC3C,EAAE,CAAC,qBAAqB,EAAE,GAAG,EAAE;QAC7B,IAAA,aAAM,EACJ,IAAA,+CAAsB,EAAC;YACrB,UAAU,EAAE,MAAM;YAClB,UAAU,EAAE,yCAAyC;YACrD,aAAa,EAAE,IAAA,WAAI,EAAC,SAAS,EAAE,QAAQ,CAAC;SACzC,CAAC,CACH,CAAC,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC;YACd,YAAY,EAAE;gBACZ,cAAc;gBACd,6BAA6B;gBAC7B,iCAAiC;gBACjC,qCAAqC;aACtC;YACD,SAAS,EAAE,EAAE;SACd,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|