afk-code 0.2.0 → 0.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/index.js +8 -7
- package/package.json +1 -1
package/dist/cli/index.js
CHANGED
|
@@ -11,7 +11,7 @@ var __export = (target, all) => {
|
|
|
11
11
|
|
|
12
12
|
// src/slack/session-manager.ts
|
|
13
13
|
import { watch } from "fs";
|
|
14
|
-
import { readdir, readFile, stat, unlink } from "fs/promises";
|
|
14
|
+
import { readdir, readFile, stat, unlink, mkdir } from "fs/promises";
|
|
15
15
|
import { createServer } from "net";
|
|
16
16
|
import { createHash } from "crypto";
|
|
17
17
|
function hash(data) {
|
|
@@ -289,6 +289,7 @@ var init_session_manager = __esm({
|
|
|
289
289
|
console.log(`[SessionManager] Waiting for JSONL changes in ${session.projectDir}`);
|
|
290
290
|
}
|
|
291
291
|
try {
|
|
292
|
+
await mkdir(session.projectDir, { recursive: true });
|
|
292
293
|
session.watcher = watch(session.projectDir, { recursive: false }, async (_, filename) => {
|
|
293
294
|
if (!filename?.endsWith(".jsonl")) return;
|
|
294
295
|
if (!session.watchedFile) {
|
|
@@ -2013,7 +2014,7 @@ async function run(command2) {
|
|
|
2013
2014
|
|
|
2014
2015
|
// src/cli/slack.ts
|
|
2015
2016
|
import { homedir as homedir3 } from "os";
|
|
2016
|
-
import { mkdir, writeFile, readFile as readFile2, access } from "fs/promises";
|
|
2017
|
+
import { mkdir as mkdir2, writeFile, readFile as readFile2, access } from "fs/promises";
|
|
2017
2018
|
import * as readline from "readline";
|
|
2018
2019
|
var CONFIG_DIR = `${homedir3()}/.afk-code`;
|
|
2019
2020
|
var SLACK_CONFIG_FILE = `${CONFIG_DIR}/slack.env`;
|
|
@@ -2089,7 +2090,7 @@ Now let's collect your tokens:
|
|
|
2089
2090
|
console.error("Invalid user ID. Should start with U");
|
|
2090
2091
|
process.exit(1);
|
|
2091
2092
|
}
|
|
2092
|
-
await
|
|
2093
|
+
await mkdir2(CONFIG_DIR, { recursive: true });
|
|
2093
2094
|
const envContent = `# AFK Code Slack Configuration
|
|
2094
2095
|
SLACK_BOT_TOKEN=${botToken}
|
|
2095
2096
|
SLACK_APP_TOKEN=${appToken}
|
|
@@ -2175,7 +2176,7 @@ async function slackRun() {
|
|
|
2175
2176
|
|
|
2176
2177
|
// src/cli/discord.ts
|
|
2177
2178
|
import { homedir as homedir4 } from "os";
|
|
2178
|
-
import { mkdir as
|
|
2179
|
+
import { mkdir as mkdir3, writeFile as writeFile2, readFile as readFile3, access as access2 } from "fs/promises";
|
|
2179
2180
|
import * as readline2 from "readline";
|
|
2180
2181
|
var CONFIG_DIR2 = `${homedir4()}/.afk-code`;
|
|
2181
2182
|
var DISCORD_CONFIG_FILE = `${CONFIG_DIR2}/discord.env`;
|
|
@@ -2251,7 +2252,7 @@ Now let's collect your credentials:
|
|
|
2251
2252
|
console.error("Invalid user ID. Should be a number.");
|
|
2252
2253
|
process.exit(1);
|
|
2253
2254
|
}
|
|
2254
|
-
await
|
|
2255
|
+
await mkdir3(CONFIG_DIR2, { recursive: true });
|
|
2255
2256
|
const envContent = `# AFK Code Discord Configuration
|
|
2256
2257
|
DISCORD_BOT_TOKEN=${botToken}
|
|
2257
2258
|
DISCORD_USER_ID=${userId}
|
|
@@ -2330,7 +2331,7 @@ async function discordRun() {
|
|
|
2330
2331
|
|
|
2331
2332
|
// src/cli/telegram.ts
|
|
2332
2333
|
import { homedir as homedir5 } from "os";
|
|
2333
|
-
import { mkdir as
|
|
2334
|
+
import { mkdir as mkdir4, writeFile as writeFile3, readFile as readFile4, access as access3 } from "fs/promises";
|
|
2334
2335
|
import * as readline3 from "readline";
|
|
2335
2336
|
var CONFIG_DIR3 = `${homedir5()}/.afk-code`;
|
|
2336
2337
|
var TELEGRAM_CONFIG_FILE = `${CONFIG_DIR3}/telegram.env`;
|
|
@@ -2390,7 +2391,7 @@ Step 2: Get Your Chat ID
|
|
|
2390
2391
|
console.error("Invalid chat ID. It should be a number (can be negative for groups).");
|
|
2391
2392
|
process.exit(1);
|
|
2392
2393
|
}
|
|
2393
|
-
await
|
|
2394
|
+
await mkdir4(CONFIG_DIR3, { recursive: true });
|
|
2394
2395
|
const envContent = `# AFK Code Telegram Configuration
|
|
2395
2396
|
TELEGRAM_BOT_TOKEN=${botToken}
|
|
2396
2397
|
TELEGRAM_CHAT_ID=${chatId}
|