git-aic 1.2.0 → 1.2.1
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/cli.js +8 -3
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import fs from "fs/promises";
|
|
3
|
+
import { readFileSync } from "fs";
|
|
4
|
+
import { join, dirname } from "path";
|
|
5
|
+
import { fileURLToPath } from "url";
|
|
3
6
|
import { Command } from "commander";
|
|
4
7
|
import { simpleGit } from "simple-git";
|
|
5
8
|
import chalk from "chalk";
|
|
@@ -12,15 +15,17 @@ import { DEFAULT_SYSTEM_PROMPT } from "./prompt.js";
|
|
|
12
15
|
process.on("SIGINT", () => {
|
|
13
16
|
process.exit(0);
|
|
14
17
|
});
|
|
18
|
+
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
19
|
+
const pkg = JSON.parse(readFileSync(join(__dirname, "../package.json"), "utf-8"));
|
|
15
20
|
const git = simpleGit();
|
|
16
21
|
const program = new Command();
|
|
17
22
|
function getErrorMessage(error) {
|
|
18
23
|
return error instanceof Error ? error.message : String(error);
|
|
19
24
|
}
|
|
20
25
|
program
|
|
21
|
-
.name(
|
|
22
|
-
.description(
|
|
23
|
-
.version(
|
|
26
|
+
.name(pkg.name)
|
|
27
|
+
.description(pkg.description)
|
|
28
|
+
.version(pkg.version)
|
|
24
29
|
.option("-p, --push", "push after committing")
|
|
25
30
|
.option("-i, --issue <number>", "Link commit to GitHub issue");
|
|
26
31
|
program
|