@proteinjs/conversation 1.0.6 → 1.0.8

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.
Files changed (109) hide show
  1. package/.eslintrc.js +20 -0
  2. package/.prettierignore +4 -0
  3. package/.prettierrc +8 -0
  4. package/CHANGELOG.md +18 -4
  5. package/LICENSE +21 -0
  6. package/dist/src/CodegenConversation.d.ts.map +1 -1
  7. package/dist/src/CodegenConversation.js +2 -2
  8. package/dist/src/CodegenConversation.js.map +1 -1
  9. package/dist/src/Conversation.d.ts.map +1 -1
  10. package/dist/src/Conversation.js +33 -17
  11. package/dist/src/Conversation.js.map +1 -1
  12. package/dist/src/Function.d.ts.map +1 -1
  13. package/dist/src/OpenAi.d.ts.map +1 -1
  14. package/dist/src/OpenAi.js +55 -38
  15. package/dist/src/OpenAi.js.map +1 -1
  16. package/dist/src/Paragraph.d.ts.map +1 -1
  17. package/dist/src/Paragraph.js +2 -1
  18. package/dist/src/Paragraph.js.map +1 -1
  19. package/dist/src/Sentence.d.ts.map +1 -1
  20. package/dist/src/Sentence.js +4 -2
  21. package/dist/src/Sentence.js.map +1 -1
  22. package/dist/src/code_template/Code.d.ts.map +1 -1
  23. package/dist/src/code_template/Code.js +6 -2
  24. package/dist/src/code_template/Code.js.map +1 -1
  25. package/dist/src/code_template/CodeTemplate.d.ts.map +1 -1
  26. package/dist/src/code_template/CodeTemplate.js +2 -1
  27. package/dist/src/code_template/CodeTemplate.js.map +1 -1
  28. package/dist/src/code_template/Repo.d.ts.map +1 -1
  29. package/dist/src/code_template/Repo.js +8 -4
  30. package/dist/src/code_template/Repo.js.map +1 -1
  31. package/dist/src/fs/conversation_fs/ConversationFsModerator.d.ts.map +1 -1
  32. package/dist/src/fs/conversation_fs/ConversationFsModerator.js +18 -7
  33. package/dist/src/fs/conversation_fs/ConversationFsModerator.js.map +1 -1
  34. package/dist/src/fs/conversation_fs/ConversationFsModule.d.ts.map +1 -1
  35. package/dist/src/fs/conversation_fs/ConversationFsModule.js +1 -3
  36. package/dist/src/fs/conversation_fs/ConversationFsModule.js.map +1 -1
  37. package/dist/src/fs/conversation_fs/FsFunctions.d.ts.map +1 -1
  38. package/dist/src/fs/conversation_fs/FsFunctions.js +15 -29
  39. package/dist/src/fs/conversation_fs/FsFunctions.js.map +1 -1
  40. package/dist/src/fs/git/GitModule.d.ts.map +1 -1
  41. package/dist/src/fs/git/GitModule.js.map +1 -1
  42. package/dist/src/fs/keyword_to_files_index/KeywordToFilesIndexFunctions.d.ts.map +1 -1
  43. package/dist/src/fs/keyword_to_files_index/KeywordToFilesIndexFunctions.js +2 -2
  44. package/dist/src/fs/keyword_to_files_index/KeywordToFilesIndexFunctions.js.map +1 -1
  45. package/dist/src/fs/keyword_to_files_index/KeywordToFilesIndexModule.d.ts.map +1 -1
  46. package/dist/src/fs/keyword_to_files_index/KeywordToFilesIndexModule.js +1 -3
  47. package/dist/src/fs/keyword_to_files_index/KeywordToFilesIndexModule.js.map +1 -1
  48. package/dist/src/fs/package/PackageFunctions.d.ts.map +1 -1
  49. package/dist/src/fs/package/PackageFunctions.js +20 -30
  50. package/dist/src/fs/package/PackageFunctions.js.map +1 -1
  51. package/dist/src/fs/package/PackageModule.d.ts.map +1 -1
  52. package/dist/src/fs/package/PackageModule.js +15 -8
  53. package/dist/src/fs/package/PackageModule.js.map +1 -1
  54. package/dist/src/history/MessageHistory.d.ts.map +1 -1
  55. package/dist/src/history/MessageHistory.js +6 -3
  56. package/dist/src/history/MessageHistory.js.map +1 -1
  57. package/dist/src/template/ConversationTemplate.d.ts.map +1 -1
  58. package/dist/src/template/ConversationTemplateFunctions.d.ts.map +1 -1
  59. package/dist/src/template/ConversationTemplateFunctions.js +2 -2
  60. package/dist/src/template/ConversationTemplateFunctions.js.map +1 -1
  61. package/dist/src/template/ConversationTemplateModule.d.ts.map +1 -1
  62. package/dist/src/template/ConversationTemplateModule.js +9 -7
  63. package/dist/src/template/ConversationTemplateModule.js.map +1 -1
  64. package/dist/src/template/createCode/CreateCodeConversationTemplate.d.ts.map +1 -1
  65. package/dist/src/template/createCode/CreateCodeConversationTemplate.js +2 -9
  66. package/dist/src/template/createCode/CreateCodeConversationTemplate.js.map +1 -1
  67. package/dist/src/template/createPackage/CreatePackageConversationTemplate.d.ts.map +1 -1
  68. package/dist/src/template/createPackage/CreatePackageConversationTemplate.js +1 -8
  69. package/dist/src/template/createPackage/CreatePackageConversationTemplate.js.map +1 -1
  70. package/dist/test/createKeywordFilesIndex.test.js.map +1 -1
  71. package/dist/test/openai/openai.generateList.test.js.map +1 -1
  72. package/dist/test/openai/openai.parseCodeFromMarkdown.test.js +7 -3
  73. package/dist/test/openai/openai.parseCodeFromMarkdown.test.js.map +1 -1
  74. package/dist/test/repo/repo.test.js.map +1 -1
  75. package/jest.config.js +2 -2
  76. package/package.json +9 -3
  77. package/src/CodegenConversation.ts +6 -4
  78. package/src/Conversation.ts +102 -33
  79. package/src/ConversationModule.ts +2 -2
  80. package/src/Function.ts +0 -1
  81. package/src/OpenAi.ts +128 -63
  82. package/src/Paragraph.ts +3 -2
  83. package/src/Sentence.ts +5 -3
  84. package/src/code_template/Code.ts +25 -19
  85. package/src/code_template/CodeTemplate.ts +8 -7
  86. package/src/code_template/CodeTemplateModule.ts +2 -2
  87. package/src/code_template/Repo.ts +25 -19
  88. package/src/fs/conversation_fs/ConversationFsModerator.ts +34 -20
  89. package/src/fs/conversation_fs/ConversationFsModule.ts +13 -7
  90. package/src/fs/conversation_fs/FsFunctions.ts +33 -44
  91. package/src/fs/git/GitModule.ts +2 -4
  92. package/src/fs/keyword_to_files_index/KeywordToFilesIndexFunctions.ts +31 -31
  93. package/src/fs/keyword_to_files_index/KeywordToFilesIndexModule.ts +19 -18
  94. package/src/fs/package/PackageFunctions.ts +34 -41
  95. package/src/fs/package/PackageModule.ts +33 -21
  96. package/src/history/MessageHistory.ts +7 -4
  97. package/src/history/MessageModerator.ts +1 -1
  98. package/src/template/ConversationTemplate.ts +9 -9
  99. package/src/template/ConversationTemplateFunctions.ts +8 -7
  100. package/src/template/ConversationTemplateModule.ts +24 -15
  101. package/src/template/createApp/CreateAppTemplate.ts +1 -1
  102. package/src/template/createCode/CreateCodeConversationTemplate.ts +9 -11
  103. package/src/template/createPackage/CreatePackageConversationTemplate.ts +2 -9
  104. package/src/template/createPackage/jest.config.js +2 -2
  105. package/test/createKeywordFilesIndex.test.ts +3 -3
  106. package/test/openai/openai.generateList.test.ts +5 -3
  107. package/test/openai/openai.parseCodeFromMarkdown.test.ts +10 -5
  108. package/test/repo/repo.test.ts +3 -4
  109. package/tsconfig.json +16 -20
@@ -1,7 +1,7 @@
1
1
  import { KeywordToFilesIndexModuleFactory } from '../src/fs/keyword_to_files_index/KeywordToFilesIndexModule';
2
2
 
3
- test('Create keyword-files index', async() => {
3
+ test('Create keyword-files index', async () => {
4
4
  // Example usage
5
- const index = new KeywordToFilesIndexModuleFactory().createKeywordFilesIndex(`${process.cwd()}`)
5
+ const index = new KeywordToFilesIndexModuleFactory().createKeywordFilesIndex(`${process.cwd()}`);
6
6
  console.log(JSON.stringify(index, null, 2));
7
- }, 60000)
7
+ }, 60000);
@@ -1,6 +1,8 @@
1
- import { OpenAi } from "../../src/OpenAi";
1
+ import { OpenAi } from '../../src/OpenAi';
2
2
 
3
3
  test('generateList should return an array of numbers, counting to 10', async () => {
4
4
  const numbers = ['one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine', 'ten'];
5
- expect((await OpenAi.generateList([`Create a list of numbers spelled out, from 1 to 10`])).join(' ')).toBe(numbers.join(' '));
6
- });
5
+ expect((await OpenAi.generateList([`Create a list of numbers spelled out, from 1 to 10`])).join(' ')).toBe(
6
+ numbers.join(' ')
7
+ );
8
+ });
@@ -1,11 +1,16 @@
1
- import { OpenAi } from "../../src/OpenAi";
1
+ import { OpenAi } from '../../src/OpenAi';
2
2
 
3
3
  const helloWorldCode = "console.log('hello world');";
4
4
  const helloWorldWithTicksCode = "console.log('hello ```world');";
5
5
  const logXCode = "const x = 'yo';\nconsole.log(x);";
6
- const testOneBlock = "Sure! I'm a helpful chatbot.\n```typescript\n" + helloWorldCode + "\n```";
7
- const testOneBlockWithExtraTicks = "Sure! I'm a helpful chatbot.\n```typescript\n" + helloWorldWithTicksCode + "\n```";
8
- const testTwoBlocks = "Sure! I'm a helpful chatbot.\n```typescript\n" + helloWorldCode + "\n```\n\nI'm still really helpful.\n```typescript\n" + logXCode + "\n```\n\nMore unhelpful chat";
6
+ const testOneBlock = "Sure! I'm a helpful chatbot.\n```typescript\n" + helloWorldCode + '\n```';
7
+ const testOneBlockWithExtraTicks = "Sure! I'm a helpful chatbot.\n```typescript\n" + helloWorldWithTicksCode + '\n```';
8
+ const testTwoBlocks =
9
+ "Sure! I'm a helpful chatbot.\n```typescript\n" +
10
+ helloWorldCode +
11
+ "\n```\n\nI'm still really helpful.\n```typescript\n" +
12
+ logXCode +
13
+ '\n```\n\nMore unhelpful chat';
9
14
 
10
15
  test('parseCodeFromMarkdown should parse 1 block of code', () => {
11
16
  expect(OpenAi.parseCodeFromMarkdown(testOneBlock)).toBe(helloWorldCode);
@@ -17,4 +22,4 @@ test('parseCodeFromMarkdown should parse 1 block of code that contains ticks', (
17
22
 
18
23
  test('parseCodeFromMarkdown should parse 1 block of code', () => {
19
24
  expect(OpenAi.parseCodeFromMarkdown(testTwoBlocks)).toBe(helloWorldCode + '\n\n' + logXCode);
20
- });
25
+ });
@@ -3,7 +3,6 @@ import { RepoFactory } from '../../src/code_template/Repo';
3
3
  import { Conversation } from '../../src/Conversation';
4
4
  import { Fs } from '@proteinjs/util-node';
5
5
 
6
-
7
6
  // test(`Return repo of the source files and the code they depend on`, async () => {
8
7
  // const tableTemplatePath = require.resolve('conversation/src/table.ts');
9
8
  // const repo = await new RepoFactory([tableTemplatePath]).create();
@@ -15,12 +14,12 @@ import { Fs } from '@proteinjs/util-node';
15
14
  // }, 60000);
16
15
 
17
16
  // test(`Interpret all parameters of a function`, async () => {
18
-
17
+
19
18
  // }, 60000);
20
19
 
21
20
  // test(`Gather parameter data from the user`, async () => {
22
21
  // const conversation = new Conversation();
23
-
22
+
24
23
  // }, 60000);
25
24
 
26
25
  // test(`Generate code from templates guided by user input`, async () => {
@@ -30,4 +29,4 @@ import { Fs } from '@proteinjs/util-node';
30
29
  test(`Create repo`, async () => {
31
30
  // console.log(JSON.stringify((await RepoFactory.createRepo(`${process.cwd()}`)).params, null, 4));
32
31
  // console.log(JSON.stringify(await Fs.getFilesInDirectory(`${process.cwd()}`, ['node_modules', 'dist']), null, 4));
33
- }, 60000)
32
+ }, 60000);
package/tsconfig.json CHANGED
@@ -1,23 +1,19 @@
1
1
  {
2
2
  "compilerOptions": {
3
- "rootDir": "./",
4
- "target": "es5",
5
- "module": "commonjs",
6
- "declaration": true,
7
- "declarationMap": true,
8
- "sourceMap": true,
9
- "outDir": "./dist/",
10
- "strict": true,
11
- "noImplicitAny": true,
12
- "esModuleInterop": true,
13
- "skipLibCheck": true,
14
- "forceConsistentCasingInFileNames": true,
15
- "resolveJsonModule": true,
16
- "typeRoots": [
17
- "./node_modules/@types"
18
- ],
19
- "types": [
20
- "node", "jest"
21
- ]
3
+ "rootDir": "./",
4
+ "target": "es5",
5
+ "module": "commonjs",
6
+ "declaration": true,
7
+ "declarationMap": true,
8
+ "sourceMap": true,
9
+ "outDir": "./dist/",
10
+ "strict": true,
11
+ "noImplicitAny": true,
12
+ "esModuleInterop": true,
13
+ "skipLibCheck": true,
14
+ "forceConsistentCasingInFileNames": true,
15
+ "resolveJsonModule": true,
16
+ "typeRoots": ["./node_modules/@types"],
17
+ "types": ["node", "jest"]
22
18
  }
23
- }
19
+ }