openai-code-assistant 1.0.2 → 1.0.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/README.md +8 -4
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +1 -1
- package/dist/config.js.map +1 -1
- package/dist/docs/assets/1.0.3.gif +0 -0
- package/dist/utils/generate-documentation.js +2 -2
- package/dist/utils/generate-documentation.js.map +1 -1
- package/docs/assets/1.0.3.gif +0 -0
- package/package.json +17 -2
- package/scripts/copy-docs.mjs +49 -0
package/README.md
CHANGED
|
@@ -54,16 +54,20 @@ openai-code-assistant
|
|
|
54
54
|
npx openai-code-assistant
|
|
55
55
|
```
|
|
56
56
|
|
|
57
|
+
## Demo
|
|
58
|
+
|
|
59
|
+

|
|
60
|
+
|
|
57
61
|
## Prerequisites
|
|
58
62
|
|
|
59
|
-
- Node.js installed (recommended version
|
|
63
|
+
- Node.js installed (recommended version 22 or later).
|
|
60
64
|
- OpenAI API key set in your environment variables as `OPENAI_API_KEY`.
|
|
61
|
-
- Optionally, specify the OpenAI model name using the environment variable `OPENAI_MODEL_NAME`. Defaults to `gpt-
|
|
65
|
+
- Optionally, specify the OpenAI model name using the environment variable `OPENAI_MODEL_NAME`. Defaults to `gpt-4.1-mini` if not set.
|
|
62
66
|
|
|
63
67
|
## Privacy
|
|
64
68
|
|
|
65
|
-
|
|
69
|
+
The source code of this project is private and not for public distribution. However, the use of openai-code-assistant in any projects, whether internal or external, is welcomed and encouraged.
|
|
66
70
|
|
|
67
71
|
## License
|
|
68
72
|
|
|
69
|
-
|
|
73
|
+
The source code is private and not licensed for public distribution or modification. Usage of the tool itself in projects is permitted as described in the Privacy section.
|
package/dist/config.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,eAAe,CAAC;AAGvB,eAAO,MAAM,iBAAiB,
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,eAAe,CAAC;AAGvB,eAAO,MAAM,iBAAiB,QACmB,CAAC;AAElD,eAAO,MAAM,cAAc,QAEV,CAAC"}
|
package/dist/config.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import "dotenv/config";
|
|
2
2
|
import path from "node:path";
|
|
3
|
-
export const OPENAI_MODEL_NAME = process.env.OPENAI_MODEL_NAME || "gpt-
|
|
3
|
+
export const OPENAI_MODEL_NAME = process.env.OPENAI_MODEL_NAME || "gpt-4.1-mini";
|
|
4
4
|
export const WORKSPACE_ROOT = process.env.AGENT_WORKSPACE_ROOT
|
|
5
5
|
? path.resolve(process.env.AGENT_WORKSPACE_ROOT)
|
|
6
6
|
: process.cwd();
|
package/dist/config.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,eAAe,CAAC;AACvB,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,MAAM,CAAC,MAAM,iBAAiB,GAC5B,OAAO,CAAC,GAAG,CAAC,iBAAiB,IAAI,
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,eAAe,CAAC;AACvB,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,MAAM,CAAC,MAAM,iBAAiB,GAC5B,OAAO,CAAC,GAAG,CAAC,iBAAiB,IAAI,cAAc,CAAC;AAElD,MAAM,CAAC,MAAM,cAAc,GAAG,OAAO,CAAC,GAAG,CAAC,oBAAoB;IAC5D,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,oBAAoB,CAAC;IAChD,CAAC,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC"}
|
|
Binary file
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import OpenAI from "openai";
|
|
2
2
|
import { readFileContent } from "./files.js";
|
|
3
|
-
|
|
3
|
+
import { OPENAI_MODEL_NAME } from "../config.js";
|
|
4
4
|
const openai = new OpenAI();
|
|
5
5
|
export async function generateDocumentation(filePath) {
|
|
6
6
|
const fileContent = readFileContent(filePath);
|
|
@@ -8,7 +8,7 @@ export async function generateDocumentation(filePath) {
|
|
|
8
8
|
return "Error: Unable to read file content.";
|
|
9
9
|
}
|
|
10
10
|
const response = await openai.completions.create({
|
|
11
|
-
model:
|
|
11
|
+
model: OPENAI_MODEL_NAME,
|
|
12
12
|
prompt: `Generate documentation for the following code:\n\n${fileContent}`,
|
|
13
13
|
max_tokens: 300,
|
|
14
14
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generate-documentation.js","sourceRoot":"","sources":["../../src/utils/generate-documentation.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,QAAQ,CAAC;AAC5B,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"generate-documentation.js","sourceRoot":"","sources":["../../src/utils/generate-documentation.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,QAAQ,CAAC;AAC5B,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAC7C,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAEjD,MAAM,MAAM,GAAG,IAAI,MAAM,EAAE,CAAC;AAE5B,MAAM,CAAC,KAAK,UAAU,qBAAqB,CAAC,QAAgB;IAC1D,MAAM,WAAW,GAAG,eAAe,CAAC,QAAQ,CAAC,CAAC;IAE9C,IAAI,CAAC,WAAW,EAAE,CAAC;QACjB,OAAO,qCAAqC,CAAC;IAC/C,CAAC;IAED,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,WAAW,CAAC,MAAM,CAAC;QAC/C,KAAK,EAAE,iBAAiB;QACxB,MAAM,EAAE,qDAAqD,WAAW,EAAE;QAC1E,UAAU,EAAE,GAAG;KAChB,CAAC,CAAC;IAEH,OAAO,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC;AACnC,CAAC"}
|
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "openai-code-assistant",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.4",
|
|
4
4
|
"scripts": {
|
|
5
5
|
"test": "echo \"Error: no test specified\" && exit 1",
|
|
6
6
|
"start": "node dist/index.js",
|
|
7
7
|
"dev": "tsx src/index.ts",
|
|
8
8
|
"typecheck": "tsc --noEmit",
|
|
9
|
-
"build": "tsc"
|
|
9
|
+
"build": "tsc && npm run copy-docs",
|
|
10
|
+
"copy-docs": "node scripts/copy-docs.mjs"
|
|
10
11
|
},
|
|
11
12
|
"bin": {
|
|
12
13
|
"openai-code-assistant": "dist/index.js"
|
|
@@ -14,6 +15,20 @@
|
|
|
14
15
|
"author": "https://github.com/shamshodisaev",
|
|
15
16
|
"license": "ISC",
|
|
16
17
|
"description": "",
|
|
18
|
+
"keywords": [
|
|
19
|
+
"OpenAI",
|
|
20
|
+
"AI agents",
|
|
21
|
+
"CLI tool",
|
|
22
|
+
"code assistant",
|
|
23
|
+
"code review",
|
|
24
|
+
"documentation generator",
|
|
25
|
+
"refactoring",
|
|
26
|
+
"supervisor agent",
|
|
27
|
+
"AI task orchestration",
|
|
28
|
+
"chatbot",
|
|
29
|
+
"OpenAI CLI",
|
|
30
|
+
"interactive assistant"
|
|
31
|
+
],
|
|
17
32
|
"type": "module",
|
|
18
33
|
"devDependencies": {
|
|
19
34
|
"@types/node": "^25.3.3",
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import fs from "node:fs/promises";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
import { fileURLToPath } from "node:url";
|
|
4
|
+
|
|
5
|
+
const rootDir = path.resolve(fileURLToPath(new URL("../", import.meta.url)));
|
|
6
|
+
const docsDir = path.join(rootDir, "docs");
|
|
7
|
+
const targetDir = path.join(rootDir, "dist", "docs");
|
|
8
|
+
|
|
9
|
+
async function pathExists(dir) {
|
|
10
|
+
try {
|
|
11
|
+
await fs.access(dir);
|
|
12
|
+
return true;
|
|
13
|
+
} catch {
|
|
14
|
+
return false;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
async function copyDirectory(src, dest) {
|
|
19
|
+
await fs.mkdir(dest, { recursive: true });
|
|
20
|
+
const entries = await fs.readdir(src, { withFileTypes: true });
|
|
21
|
+
|
|
22
|
+
for (const entry of entries) {
|
|
23
|
+
const srcPath = path.join(src, entry.name);
|
|
24
|
+
const destPath = path.join(dest, entry.name);
|
|
25
|
+
|
|
26
|
+
if (entry.isDirectory()) {
|
|
27
|
+
await copyDirectory(srcPath, destPath);
|
|
28
|
+
} else {
|
|
29
|
+
await fs.copyFile(srcPath, destPath);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
async function main() {
|
|
35
|
+
const hasDocs = await pathExists(docsDir);
|
|
36
|
+
if (!hasDocs) {
|
|
37
|
+
console.log("No docs directory detected. Skipping docs copy.");
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
await fs.rm(targetDir, { recursive: true, force: true });
|
|
42
|
+
await copyDirectory(docsDir, targetDir);
|
|
43
|
+
console.log(`Copied docs to ${path.relative(rootDir, targetDir)}`);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
main().catch((error) => {
|
|
47
|
+
console.error("Failed to copy docs:", error);
|
|
48
|
+
process.exitCode = 1;
|
|
49
|
+
});
|