acmecode 1.0.5 → 1.0.7
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/index.js +13 -13
- package/package.json +3 -3
- package/src/index.ts +69 -59
package/dist/index.js
CHANGED
|
@@ -2,22 +2,22 @@ import { Command } from "commander";
|
|
|
2
2
|
import { config as dotenvConfig } from "dotenv";
|
|
3
3
|
dotenvConfig({ quiet: true });
|
|
4
4
|
import pkg from "../package.json" with { type: "json" };
|
|
5
|
-
import React from
|
|
6
|
-
import { render } from
|
|
7
|
-
import App from
|
|
8
|
-
import { createSession, listSessions } from
|
|
9
|
-
import crypto from
|
|
10
|
-
import path from
|
|
5
|
+
import React from "react";
|
|
6
|
+
import { render } from "ink";
|
|
7
|
+
import App from "@acmecloud/tui/App.js";
|
|
8
|
+
import { createSession, listSessions, } from "@acmecloud/core/session/index.js";
|
|
9
|
+
import crypto from "crypto";
|
|
10
|
+
import path from "path";
|
|
11
11
|
function main() {
|
|
12
12
|
const program = new Command();
|
|
13
13
|
program
|
|
14
14
|
.name("acmecode")
|
|
15
15
|
.description("AI Coding Assistant CLI")
|
|
16
16
|
.version(pkg.version)
|
|
17
|
-
.argument(
|
|
18
|
-
.option(
|
|
19
|
-
.option(
|
|
20
|
-
.option(
|
|
17
|
+
.argument("[dir]", "Directory to run in", ".")
|
|
18
|
+
.option("-n, --new", "Create a new session")
|
|
19
|
+
.option("-s, --session <id>", "Resume a specific session ID")
|
|
20
|
+
.option("--list", "List all sessions")
|
|
21
21
|
.action((dir, options) => {
|
|
22
22
|
// Change current working directory to the specified directory
|
|
23
23
|
const targetDir = path.resolve(process.cwd(), dir);
|
|
@@ -30,8 +30,8 @@ function main() {
|
|
|
30
30
|
}
|
|
31
31
|
if (options.list) {
|
|
32
32
|
const sessions = listSessions();
|
|
33
|
-
console.log(
|
|
34
|
-
sessions.forEach(s => console.log(`- ${s.id} (${s.title}) updated at ${s.updated_at}`));
|
|
33
|
+
console.log("Available Sessions:");
|
|
34
|
+
sessions.forEach((s) => console.log(`- ${s.id} (${s.title}) updated at ${s.updated_at}`));
|
|
35
35
|
process.exit(0);
|
|
36
36
|
}
|
|
37
37
|
let sessionId = options.session;
|
|
@@ -45,7 +45,7 @@ function main() {
|
|
|
45
45
|
onExit: () => {
|
|
46
46
|
unmount();
|
|
47
47
|
process.exit(0);
|
|
48
|
-
}
|
|
48
|
+
},
|
|
49
49
|
}));
|
|
50
50
|
});
|
|
51
51
|
program.parse();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "acmecode",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.7",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "AI Coding Assistant CLI",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -13,8 +13,8 @@
|
|
|
13
13
|
"dev": "tsx src/index.ts"
|
|
14
14
|
},
|
|
15
15
|
"dependencies": {
|
|
16
|
-
"@acmecloud/core": "^1.0.
|
|
17
|
-
"@acmecloud/tui": "^1.0.
|
|
16
|
+
"@acmecloud/core": "^1.0.6",
|
|
17
|
+
"@acmecloud/tui": "^1.0.5",
|
|
18
18
|
"commander": "^14.0.3",
|
|
19
19
|
"ink": "^6.8.0",
|
|
20
20
|
"react": "^19.2.4"
|
package/src/index.ts
CHANGED
|
@@ -1,59 +1,69 @@
|
|
|
1
|
-
import { Command } from "commander";
|
|
2
|
-
import { config as dotenvConfig } from "dotenv";
|
|
3
|
-
dotenvConfig({ quiet: true });
|
|
4
|
-
import pkg from "../package.json" with { type: "json" };
|
|
5
|
-
import React from
|
|
6
|
-
import { render } from
|
|
7
|
-
import App from
|
|
8
|
-
import {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
1
|
+
import { Command } from "commander";
|
|
2
|
+
import { config as dotenvConfig } from "dotenv";
|
|
3
|
+
dotenvConfig({ quiet: true });
|
|
4
|
+
import pkg from "../package.json" with { type: "json" };
|
|
5
|
+
import React from "react";
|
|
6
|
+
import { render } from "ink";
|
|
7
|
+
import App from "@acmecloud/tui/App.js";
|
|
8
|
+
import {
|
|
9
|
+
createSession,
|
|
10
|
+
listSessions,
|
|
11
|
+
deleteSession,
|
|
12
|
+
} from "@acmecloud/core/session/index.js";
|
|
13
|
+
import crypto from "crypto";
|
|
14
|
+
import path from "path";
|
|
15
|
+
|
|
16
|
+
function main() {
|
|
17
|
+
const program = new Command();
|
|
18
|
+
|
|
19
|
+
program
|
|
20
|
+
.name("acmecode")
|
|
21
|
+
.description("AI Coding Assistant CLI")
|
|
22
|
+
.version(pkg.version)
|
|
23
|
+
.argument("[dir]", "Directory to run in", ".")
|
|
24
|
+
.option("-n, --new", "Create a new session")
|
|
25
|
+
.option("-s, --session <id>", "Resume a specific session ID")
|
|
26
|
+
.option("--list", "List all sessions")
|
|
27
|
+
.action((dir, options) => {
|
|
28
|
+
// Change current working directory to the specified directory
|
|
29
|
+
const targetDir = path.resolve(process.cwd(), dir);
|
|
30
|
+
try {
|
|
31
|
+
process.chdir(targetDir);
|
|
32
|
+
} catch (err: any) {
|
|
33
|
+
console.error(
|
|
34
|
+
`Failed to change directory to ${targetDir}: ${err.message}`,
|
|
35
|
+
);
|
|
36
|
+
process.exit(1);
|
|
37
|
+
}
|
|
38
|
+
if (options.list) {
|
|
39
|
+
const sessions = listSessions();
|
|
40
|
+
console.log("Available Sessions:");
|
|
41
|
+
sessions.forEach((s) =>
|
|
42
|
+
console.log(`- ${s.id} (${s.title}) updated at ${s.updated_at}`),
|
|
43
|
+
);
|
|
44
|
+
process.exit(0);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
let sessionId = options.session;
|
|
48
|
+
|
|
49
|
+
// Always create a fresh session unless explicitly resuming one
|
|
50
|
+
if (!sessionId) {
|
|
51
|
+
sessionId = crypto.randomUUID().slice(0, 8);
|
|
52
|
+
createSession(sessionId, `Session ${new Date().toLocaleString()}`);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
const { unmount } = render(
|
|
56
|
+
React.createElement(App, {
|
|
57
|
+
sessionId: sessionId,
|
|
58
|
+
onExit: () => {
|
|
59
|
+
unmount();
|
|
60
|
+
process.exit(0);
|
|
61
|
+
},
|
|
62
|
+
}),
|
|
63
|
+
);
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
program.parse();
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
main();
|