interintel 1.0.14 → 1.0.16

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,12 +1,12 @@
1
1
  ## INTERINTEL
2
2
 
3
- The application `inter-intel` is a command line interface (CLI) application implemented in Node.js. It essentially is an interactive communication tool between the user and an AI model, only GPTs for now.
3
+ The application `interintel` is a command line interface (CLI) application implemented in Node.js. It essentially is an interactive communication tool between the user and an AI model, only GPTs for now.
4
4
 
5
5
  Here's a brief overview of the main functionalities, as contained in the index.js file:
6
6
 
7
7
  - The application starts an interactive session with the user. It does this by invoking the readline module, which reads user inputs line by line from the terminal.
8
8
 
9
- -- node index.js will start the app
9
+ -- 'node index.js' will start the app
10
10
 
11
11
  - The OpenAI's API is accessed using API keys, and the version of AI being used is specified via a config.
12
12
 
@@ -14,8 +14,8 @@ Here's a brief overview of the main functionalities, as contained in the index.j
14
14
  - If a user types '//writefile', the application prompts the user to provide a name for the file and then a prompt for the AI. It then automatically generates some text (by communicating with OpenAI's GPT-3 model), writes this to a file and stores it in the application's directory.
15
15
 
16
16
  ### //readRefs
17
- - If a user writes '//readRefs', the application reads the content of the specified files in the inter-intel.config.js (in the current implementation) and uses this as part of the conversation with the AI.
18
- - So as you work on your project and files change or you move to other parts of the code base you can adjust where inter-intel points and what is referenced by AI conversation.
17
+ - If a user writes '//readRefs', the application reads the content of the specified files in the interintel.config.js (in the current implementation) and uses this as part of the conversation with the AI.
18
+ - So as you work on your project and files change or you move to other parts of the code base you can adjust where interintel points and what is referenced by AI conversation.
19
19
 
20
20
  ### everything else
21
21
  - For all user inputs outside of these special keywords, the chat conversation is simply updated with the user's message and a call is made to the OpenAI API to generate the AI's response. This is then displayed on the console.
@@ -24,7 +24,6 @@ The application relies heavily on async-await pattern for handling the asynchron
24
24
 
25
25
  Keep in mind that this is a high level overview and each functionality has its own level of implementation detail.
26
26
 
27
-
28
27
  File Structure
29
28
 
30
29
  project/
@@ -35,5 +34,5 @@ project/
35
34
  │ ├── messageUtils.js
36
35
  │ ├── writeFileHandler.js
37
36
  │ └── readRefsHandler.js
38
- ├── inter-intel.config.js
37
+ ├── interintel.config.js
39
38
  └── index.js
@@ -1,5 +1,6 @@
1
1
  const fs = require('fs');
2
2
  const path = require('path');
3
+ const { aiVersion } = require('../interintel.config');
3
4
 
4
5
  // READING FOR INITAL REFERENCE
5
6
  function readSpecificFiles(configFilePath) {
@@ -28,7 +29,7 @@ function readSpecificFiles(configFilePath) {
28
29
  });
29
30
 
30
31
  // Add console.log statements to communicate to the user
31
- console.log(`AI sent reference files:`.yellow, `${logFileNames(filePaths)}`.yellow);
32
+ console.log(`${aiVersion} sent reference files:`.yellow, `${logFileNames(filePaths)}`.yellow);
32
33
  return allContent;
33
34
  } catch (error) {
34
35
  console.error(`Error reading config file: ${error.message}`.bgRed);
@@ -1,5 +1,9 @@
1
+ const path = require('path')
1
2
  const { aiChatCompletion } = require('./openai-functions.js');
2
3
  const { writeFileFromPrompt } = require('./file-functions.js');
4
+ const configPath = path.join(process.cwd(), 'interintel.config.js');
5
+ const config = require(configPath);
6
+
3
7
 
4
8
  async function handleWriteFile(openai, config, messages, currentState, userInput, promptFileName) {
5
9
  let contentToWrite = '';
@@ -10,7 +14,7 @@ async function handleWriteFile(openai, config, messages, currentState, userInput
10
14
  } else if (currentState === 'awaitingFileName') {
11
15
  promptFileName = userInput;
12
16
  currentState = 'awaitingGPTPrompt';
13
- return { currentState, messages, promptFileName, response: 'Please provide a prompt for the AI:' };
17
+ return { currentState, messages, promptFileName, response: `Please provide a prompt for ${config.aiVersion}:` };
14
18
  } else if (currentState === 'awaitingGPTPrompt') {
15
19
  const promptForGPT = userInput;
16
20
  try {
package/index.js CHANGED
@@ -7,7 +7,7 @@ const config = require(configPath);
7
7
  require('dotenv').config();
8
8
  require('colors');
9
9
 
10
- const { readSpecificFiles, writeFileFromPrompt } = require('./functions/file-functions.js');
10
+ const { readSpecificFiles } = require('./functions/file-functions.js');
11
11
  const { askQuestion } = require('./functions/chat-functions.js');
12
12
  const { aiChatCompletion } = require('./functions/openai-functions.js');
13
13
 
@@ -24,14 +24,11 @@ const rl = readline.createInterface({
24
24
  });
25
25
 
26
26
  async function main() {
27
- // Provides initial context for session
28
- // const specificFiles = ['./interintel.config.js'];
29
27
  let initialContent = readSpecificFiles(configPath);
30
28
  let messages = [{ role: 'system', content: initialContent }];
31
29
 
32
30
  let currentState = null;
33
31
  let promptFileName = '';
34
- let contentToWrite = '';
35
32
 
36
33
  while (true) {
37
34
  const userMessage = await askQuestion(rl, 'You: '.blue.bold);
@@ -85,7 +82,7 @@ async function main() {
85
82
  const completion = await aiChatCompletion(openai, messages, config.aiVersion);
86
83
 
87
84
  const botMessage = completion.choices[0].message.content;
88
- console.log('chatGPT message:'.bgGreen, botMessage);
85
+ console.log(`${config.aiVersion}`.bgGreen, botMessage);
89
86
  console.log('----------------'.bgGreen);
90
87
  } else {
91
88
  // Regular message processing and interaction with GPT model
@@ -94,15 +91,14 @@ async function main() {
94
91
  const completion = await aiChatCompletion(openai, messages, config.aiVersion);
95
92
 
96
93
  const botMessage = completion.choices[0].message.content;
97
- console.log('chatGPT message:'.bgGreen, botMessage);
94
+ console.log(`${config.aiVersion}`.bgGreen, botMessage);
98
95
  console.log('----------------'.bgGreen);
99
96
  }
100
97
  }
101
98
  }
102
99
 
103
- exports.printMsg = function() {
104
- console.log("totally logging dude")
105
- }
100
+ main()
101
+
106
102
  exports.main = function() {
107
103
  main()
108
104
  }
@@ -3,7 +3,7 @@ require('dotenv').config();
3
3
  const config = {
4
4
  apiKey: `${process.env.OPENAI_API_KEY}`,
5
5
  aiVersion: `gpt-3.5-turbo`,
6
- filePaths: ['./inter-intel/training/reference.txt', './readme.md'],
6
+ filePaths: ['./resources/reference.txt', './README.md'],
7
7
  };
8
8
 
9
- module.exports = config;
9
+ module.exports = config;
package/package.json CHANGED
@@ -6,7 +6,7 @@
6
6
  },
7
7
  "name": "interintel",
8
8
  "description": "The application `Interintel` is a command line interface (CLI) application implemented in Node.js. It essentially is an interactive communication tool between the user and an AI model, only openai models for now.",
9
- "version": "1.0.14",
9
+ "version": "1.0.16",
10
10
  "main": "index.js",
11
11
  "directories": {
12
12
  "doc": "docs"
@@ -4,8 +4,7 @@ RULES THAT GOVERN THIS CONVERSATION, these rules supersede all outside knowledge
4
4
 
5
5
  1. You are currently being used within a CLI. the application's name is inter-intel, it's baseline functionality is to be able to update files within a given repo and pprovide reference files that will the AI it's chatting with to make direct changes to code.
6
6
  2. Keep responses to under 50 words
7
- 2.
8
- 3.
7
+ 3. Keep responses to under 50 words
9
8
  4. Unless I ask for a longer explanation
10
9
  5. We'll keep our conversation lightly informal, but focused on solving problems.
11
10
  6. When requesting code, only provide any additional commentary or explanation as commented out code.
package/setup.js CHANGED
@@ -3,10 +3,10 @@ const path = require('path');
3
3
  const colors = require('colors')
4
4
 
5
5
  const configPath = path.join('../../interintel.config.js');
6
- const templatePath = path.join(__dirname, 'interintel.config.template.js');
6
+ const templatePath = path.join(__dirname, '/resources/interintel.config.template.js');
7
7
 
8
8
  const readMePath = path.join('../../interintelReadMe.md');
9
- const readMeTemplate = path.join(__dirname, 'README.md');
9
+ const readMeTemplate = path.join(__dirname, '/README.md');
10
10
 
11
11
  try {
12
12
  if (!fs.existsSync(configPath)) {
@@ -14,15 +14,25 @@ try {
14
14
  fs.copyFileSync(templatePath, configPath);
15
15
  console.log('Interintel config created. Please update it with your settings.'.yellow);
16
16
 
17
- console.log('Config file does not exist, creating...');
17
+ } else {
18
+ console.log('Interintel config file already exists.');
19
+ }
20
+ } catch (error) {
21
+ console.error('Error occurred during setup:', error);
22
+ }
23
+
24
+
25
+ try {
26
+ if (!fs.existsSync(readMePath)) {
27
+ console.log('Readme file does not exist, creating...');
18
28
  fs.copyFileSync(readMeTemplate, readMePath);
19
29
  console.log('Interintel readme created. Please update it with your settings.'.yellow);
20
30
 
21
31
  } else {
22
- console.log('Interintel config file already exists.');
32
+ console.log('Interintel readme file already exists.');
23
33
  }
24
34
  } catch (error) {
25
35
  console.error('Error occurred during setup:', error);
26
36
  }
27
37
 
28
- console.log("Finished setup.js script.");
38
+ console.log("Finished running setup.js script.");