autohand-cli 0.6.2 → 0.6.3

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.
Files changed (148) hide show
  1. package/README.md +1 -0
  2. package/dist/chunk-KT55HW6V.js +168 -0
  3. package/dist/{chunk-7WBK33MM.js → chunk-KZ2UXXLH.js} +4 -2
  4. package/dist/{chunk-KERHTHMK.js → chunk-KZ4QOKII.js} +9 -7
  5. package/dist/{chunk-RUQVXU6K.js → chunk-MRQV5HMC.js} +4 -2
  6. package/dist/chunk-NWXYG5PQ.js +93 -0
  7. package/dist/chunk-UBGEAEKS.js +1135 -0
  8. package/dist/{chunk-TVWTD63Y.js → chunk-Z3Q2AFDS.js} +1 -0
  9. package/dist/{help-CNOV6OXY.js → help-PKC6QCNG.js} +1 -1
  10. package/dist/index.cjs +9191 -2964
  11. package/dist/index.js +8009 -2834
  12. package/dist/{login-Y7XXSNOZ.js → login-MBMAXHG6.js} +3 -2
  13. package/dist/{logout-6KCD4WA3.js → logout-VI6YMV7P.js} +3 -2
  14. package/dist/{status-IT5CYW37.js → status-XQSGXTHN.js} +1 -1
  15. package/dist/theme-B5QZLGKP.js +12 -0
  16. package/package.json +9 -7
  17. package/dist/agents-32JB7KMB.js +0 -9
  18. package/dist/agents-3K6PHXQ6.js +0 -9
  19. package/dist/agents-A7AUMVQD.js +0 -8
  20. package/dist/agents-AHFECO5Q.js +0 -9
  21. package/dist/agents-DQFYBMJG.js +0 -8
  22. package/dist/agents-GX6L7BXZ.js +0 -9
  23. package/dist/agents-IWJJ7YJM.js +0 -8
  24. package/dist/agents-J2QLDVOP.js +0 -9
  25. package/dist/agents-OWTSY74S.js +0 -9
  26. package/dist/agents-RB34F4XE.js +0 -9
  27. package/dist/agents-XL27P67O.js +0 -9
  28. package/dist/agents-new-5I3B2W2I.js +0 -9
  29. package/dist/agents-new-CHV2AV34.js +0 -9
  30. package/dist/agents-new-F6F2VMDB.js +0 -9
  31. package/dist/agents-new-FDMUH7NL.js +0 -9
  32. package/dist/agents-new-GBF6JJIA.js +0 -9
  33. package/dist/agents-new-GCZEY4TE.js +0 -8
  34. package/dist/agents-new-OCIB72NU.js +0 -9
  35. package/dist/agents-new-PQGD47BZ.js +0 -9
  36. package/dist/agents-new-V6BNVJAB.js +0 -9
  37. package/dist/agents-new-WQUEZ2XH.js +0 -8
  38. package/dist/chunk-2DEJU7WQ.js +0 -373
  39. package/dist/chunk-2EPIFDFM.js +0 -68
  40. package/dist/chunk-2FUWKZFN.js +0 -68
  41. package/dist/chunk-2HIILNYH.js +0 -197
  42. package/dist/chunk-2QAL3HH4.js +0 -79
  43. package/dist/chunk-3FRM7HJY.js +0 -57
  44. package/dist/chunk-3OD5MR23.js +0 -384
  45. package/dist/chunk-4LDR3Y3A.js +0 -79
  46. package/dist/chunk-4LLTISFP.js +0 -288
  47. package/dist/chunk-4UISIRMD.js +0 -288
  48. package/dist/chunk-4VWPX2X3.js +0 -131
  49. package/dist/chunk-7FMMKTRG.js +0 -64
  50. package/dist/chunk-7MFSCH7E.js +0 -382
  51. package/dist/chunk-7TV5KURP.js +0 -79
  52. package/dist/chunk-7XN6PAKV.js +0 -79
  53. package/dist/chunk-A7HRTONQ.js +0 -382
  54. package/dist/chunk-ALMJANSA.js +0 -197
  55. package/dist/chunk-CD7GNBIE.js +0 -288
  56. package/dist/chunk-CV3LEQRD.js +0 -57
  57. package/dist/chunk-CYY7D5TQ.js +0 -57
  58. package/dist/chunk-DAHMHLM6.js +0 -102
  59. package/dist/chunk-DAMLAWGE.js +0 -68
  60. package/dist/chunk-F4YPGOQJ.js +0 -105
  61. package/dist/chunk-FQDXFNOI.js +0 -57
  62. package/dist/chunk-FQI7EJY2.js +0 -105
  63. package/dist/chunk-GAJCZDZ5.js +0 -286
  64. package/dist/chunk-GEOP77H3.js +0 -79
  65. package/dist/chunk-GRX3IQHC.js +0 -131
  66. package/dist/chunk-GX24PC3L.js +0 -288
  67. package/dist/chunk-H53NQAC2.js +0 -131
  68. package/dist/chunk-HJYISR7Y.js +0 -382
  69. package/dist/chunk-HLSI4HQM.js +0 -105
  70. package/dist/chunk-IAOMCEYU.js +0 -68
  71. package/dist/chunk-J7RENRJG.js +0 -382
  72. package/dist/chunk-JUDX6E53.js +0 -105
  73. package/dist/chunk-JZQKOM7X.js +0 -382
  74. package/dist/chunk-K75NWR5V.js +0 -108
  75. package/dist/chunk-KCMWJB53.js +0 -288
  76. package/dist/chunk-KJ4M6KAK.js +0 -57
  77. package/dist/chunk-L3JXU574.js +0 -77
  78. package/dist/chunk-LR2XPUPT.js +0 -236
  79. package/dist/chunk-MCWNGAZG.js +0 -198
  80. package/dist/chunk-MQTBFYEG.js +0 -288
  81. package/dist/chunk-NCUJWSGP.js +0 -287
  82. package/dist/chunk-NWEUBPSG.js +0 -79
  83. package/dist/chunk-OJ5EBWOQ.js +0 -232
  84. package/dist/chunk-PKQZWNS2.js +0 -131
  85. package/dist/chunk-PQJIQBQ5.js +0 -57
  86. package/dist/chunk-PX5AGAEX.js +0 -105
  87. package/dist/chunk-Q7HX4VZD.js +0 -197
  88. package/dist/chunk-QE5RKNVN.js +0 -30
  89. package/dist/chunk-QLVXFPE3.js +0 -145
  90. package/dist/chunk-QUC577LO.js +0 -79
  91. package/dist/chunk-RAL2W5UX.js +0 -55
  92. package/dist/chunk-RANNBYFJ.js +0 -105
  93. package/dist/chunk-RCSSFUGL.js +0 -131
  94. package/dist/chunk-RZ7TASUI.js +0 -57
  95. package/dist/chunk-SN7D2PJO.js +0 -68
  96. package/dist/chunk-T4WQUJAE.js +0 -79
  97. package/dist/chunk-U2Z5BABG.js +0 -57
  98. package/dist/chunk-UHC4DIK5.js +0 -105
  99. package/dist/chunk-UNS4S6J3.js +0 -197
  100. package/dist/chunk-UW2LYWIM.js +0 -131
  101. package/dist/chunk-VRCQBFSX.js +0 -102
  102. package/dist/chunk-W76N6IZV.js +0 -197
  103. package/dist/chunk-WMC556GK.js +0 -131
  104. package/dist/chunk-WTEZYXD2.js +0 -67
  105. package/dist/chunk-X7EWON4T.js +0 -105
  106. package/dist/chunk-XARAKKJ4.js +0 -197
  107. package/dist/chunk-Y6JDGDEE.js +0 -197
  108. package/dist/chunk-Y7FSNXMR.js +0 -382
  109. package/dist/chunk-YPZMUIB5.js +0 -50
  110. package/dist/chunk-ZMDUVLR4.js +0 -148
  111. package/dist/chunk-ZRFAICDG.js +0 -382
  112. package/dist/export-HEFUNSR4.js +0 -8
  113. package/dist/feedback-3U2WYQK6.js +0 -9
  114. package/dist/feedback-5IIX372K.js +0 -9
  115. package/dist/feedback-6S6DWGIU.js +0 -9
  116. package/dist/feedback-7DEOY2AP.js +0 -9
  117. package/dist/feedback-BBQT42R6.js +0 -9
  118. package/dist/feedback-CGCSAWQT.js +0 -9
  119. package/dist/feedback-NEDFOKMA.js +0 -9
  120. package/dist/feedback-OXGGJVNA.js +0 -9
  121. package/dist/feedback-ZJECE2FS.js +0 -8
  122. package/dist/help-NQUZ7TNJ.js +0 -10
  123. package/dist/login-D53NQ7UY.js +0 -10
  124. package/dist/login-GPXDNB2F.js +0 -10
  125. package/dist/login-HDF4GSTP.js +0 -10
  126. package/dist/login-HXQ3FDA7.js +0 -10
  127. package/dist/login-SDAZTJAK.js +0 -10
  128. package/dist/login-SM6LEDDA.js +0 -10
  129. package/dist/login-TDI7HBRZ.js +0 -10
  130. package/dist/logout-32RNT7G2.js +0 -10
  131. package/dist/logout-43W7N6JU.js +0 -10
  132. package/dist/logout-BMHTSXIY.js +0 -10
  133. package/dist/logout-JNNJJYYL.js +0 -10
  134. package/dist/logout-LW42QASH.js +0 -10
  135. package/dist/logout-QLWM6P26.js +0 -10
  136. package/dist/logout-TL7GLGWU.js +0 -10
  137. package/dist/memory-GVYG653L.js +0 -8
  138. package/dist/new-MCN36AOD.js +0 -8
  139. package/dist/status-DCVSUWZG.js +0 -8
  140. package/dist/status-F6TQOCON.js +0 -8
  141. package/dist/status-MRJOSVE3.js +0 -8
  142. package/dist/status-MWFV2DZG.js +0 -8
  143. package/dist/status-N3PMJRSB.js +0 -8
  144. package/dist/status-NK7YSBXZ.js +0 -8
  145. package/dist/status-QLQ5ZKJ3.js +0 -8
  146. package/dist/status-SQEFMII5.js +0 -8
  147. package/dist/status-U33PEUBO.js +0 -8
  148. package/dist/status-XAJH67SE.js +0 -8
@@ -1,79 +0,0 @@
1
- import {
2
- AUTOHAND_FILES
3
- } from "./chunk-2FUWKZFN.js";
4
-
5
- // src/commands/feedback.ts
6
- import fs from "fs-extra";
7
- import chalk from "chalk";
8
- import enquirer from "enquirer";
9
- var metadata = {
10
- command: "/feedback",
11
- description: "share feedback with environment details",
12
- implemented: true
13
- };
14
- async function feedback(_ctx) {
15
- const answer = await enquirer.prompt([
16
- {
17
- type: "input",
18
- name: "feedback",
19
- message: "What worked? What broke?"
20
- }
21
- ]);
22
- if (!answer.feedback?.trim()) {
23
- console.log(chalk.gray("Feedback discarded (empty)."));
24
- return null;
25
- }
26
- const now = (/* @__PURE__ */ new Date()).toISOString();
27
- const runtimeError = getLastRuntimeError();
28
- const payload = {
29
- timestamp: now,
30
- feedback: answer.feedback.trim(),
31
- env: {
32
- platform: `${process.platform}-${process.arch}`,
33
- node: process.version,
34
- bun: process.versions?.bun,
35
- cwd: process.cwd(),
36
- shell: process.env.SHELL
37
- },
38
- runtimeError: runtimeError ? formatError(runtimeError) : null
39
- };
40
- try {
41
- const feedbackPath = AUTOHAND_FILES.feedbackLog;
42
- await fs.ensureFile(feedbackPath);
43
- await fs.appendFile(feedbackPath, JSON.stringify(payload) + "\n", "utf8");
44
- console.log(chalk.green("Feedback recorded."));
45
- console.log(chalk.gray(`Saved to ${feedbackPath}`));
46
- } catch (error) {
47
- console.error(chalk.red(`Failed to save feedback: ${error.message}`));
48
- }
49
- if (runtimeError) {
50
- console.log(chalk.yellow("Detected a recent runtime error; included in feedback payload."));
51
- }
52
- return null;
53
- }
54
- function getLastRuntimeError() {
55
- const globalAny = globalThis;
56
- return globalAny.__autohandLastError ?? null;
57
- }
58
- function formatError(err) {
59
- if (!err) return {};
60
- if (err instanceof Error) {
61
- return { message: err.message, stack: err.stack };
62
- }
63
- if (typeof err === "object") {
64
- const message = "message" in err ? String(err.message) : void 0;
65
- const stack = "stack" in err ? String(err.stack) : void 0;
66
- return { message, stack };
67
- }
68
- return { message: String(err) };
69
- }
70
-
71
- export {
72
- metadata,
73
- feedback
74
- };
75
- /**
76
- * @license
77
- * Copyright 2025 Autohand AI LLC
78
- * SPDX-License-Identifier: Apache-2.0
79
- */
@@ -1,55 +0,0 @@
1
- // src/constants.ts
2
- import os from "os";
3
- import path from "path";
4
- var AUTOHAND_HOME = process.env.AUTOHAND_HOME || path.join(os.homedir(), ".autohand");
5
- var AUTOHAND_PATHS = {
6
- /** Configuration files (config.json, config.yaml, config.yml) */
7
- config: AUTOHAND_HOME,
8
- /** Session data storage */
9
- sessions: path.join(AUTOHAND_HOME, "sessions"),
10
- /** Project knowledge base */
11
- projects: path.join(AUTOHAND_HOME, "projects"),
12
- /** User-level memory */
13
- memory: path.join(AUTOHAND_HOME, "memory"),
14
- /** Feedback state and responses */
15
- feedback: path.join(AUTOHAND_HOME, "feedback"),
16
- /** Telemetry data */
17
- telemetry: path.join(AUTOHAND_HOME, "telemetry"),
18
- /** Custom commands */
19
- commands: path.join(AUTOHAND_HOME, "commands"),
20
- /** Agent definitions */
21
- agents: path.join(AUTOHAND_HOME, "agents"),
22
- /** Custom tools */
23
- tools: path.join(AUTOHAND_HOME, "tools")
24
- };
25
- var AUTOHAND_FILES = {
26
- /** Main config file */
27
- configJson: path.join(AUTOHAND_HOME, "config.json"),
28
- configYaml: path.join(AUTOHAND_HOME, "config.yaml"),
29
- configYml: path.join(AUTOHAND_HOME, "config.yml"),
30
- /** Device ID for telemetry */
31
- deviceId: path.join(AUTOHAND_HOME, "device-id"),
32
- /** Error log */
33
- errorLog: path.join(AUTOHAND_HOME, "error.log"),
34
- /** Feedback log */
35
- feedbackLog: path.join(AUTOHAND_HOME, "feedback.log"),
36
- /** Telemetry queue */
37
- telemetryQueue: path.join(AUTOHAND_PATHS.telemetry, "queue.json"),
38
- /** Session sync queue */
39
- sessionSyncQueue: path.join(AUTOHAND_PATHS.telemetry, "session-sync-queue.json")
40
- };
41
- var PROJECT_DIR_NAME = ".autohand";
42
-
43
- export {
44
- AUTOHAND_HOME,
45
- AUTOHAND_PATHS,
46
- AUTOHAND_FILES,
47
- PROJECT_DIR_NAME
48
- };
49
- /**
50
- * @license
51
- * Copyright 2025 Autohand AI LLC
52
- * SPDX-License-Identifier: Apache-2.0
53
- *
54
- * Centralized constants for Autohand CLI
55
- */
@@ -1,105 +0,0 @@
1
- import {
2
- AUTOHAND_PATHS
3
- } from "./chunk-2FUWKZFN.js";
4
-
5
- // src/commands/agents-new.ts
6
- import path from "path";
7
- import fs from "fs-extra";
8
- import chalk from "chalk";
9
- import enquirer from "enquirer";
10
- var metadata = {
11
- command: "/agents new",
12
- description: "create a new sub-agent from a description",
13
- implemented: true,
14
- prd: "prd/sub_agents_architecture.md"
15
- };
16
- async function createAgent(ctx) {
17
- const answers = await enquirer.prompt([
18
- {
19
- type: "input",
20
- name: "name",
21
- message: "Agent name (e.g., Researcher, QA Tester)",
22
- validate: (val) => typeof val === "string" && val.trim() ? true : "Name is required"
23
- },
24
- {
25
- type: "input",
26
- name: "description",
27
- message: "Briefly describe what the agent should do"
28
- }
29
- ]);
30
- const name = answers.name.trim();
31
- const description = answers.description.trim();
32
- if (!name) {
33
- console.log(chalk.gray("Canceled: no name provided."));
34
- return null;
35
- }
36
- const filename = await ensureUniqueFilename(name);
37
- const filePath = path.join(getAgentsDir(), filename);
38
- const prompt = buildPrompt(name, description);
39
- let content;
40
- try {
41
- const completion = await ctx.llm.complete({
42
- messages: [
43
- {
44
- role: "system",
45
- content: "You generate concise markdown definitions for sub-agents. Output only markdown with no code fences. Keep it short but complete."
46
- },
47
- { role: "user", content: prompt }
48
- ],
49
- maxTokens: 600
50
- });
51
- content = completion.content.trim();
52
- } catch (error) {
53
- console.error(chalk.red(`Failed to generate agent: ${error.message}`));
54
- return null;
55
- }
56
- try {
57
- await fs.ensureDir(getAgentsDir());
58
- await fs.writeFile(filePath, content + "\n", "utf8");
59
- console.log(chalk.green(`Saved new agent to ${filePath}`));
60
- } catch (error) {
61
- console.error(chalk.red(`Failed to save agent: ${error.message}`));
62
- return null;
63
- }
64
- return null;
65
- }
66
- function buildPrompt(name, description) {
67
- return [
68
- `Create a sub-agent markdown file for "${name}".`,
69
- description ? `Agent description: ${description}` : "",
70
- "Structure it as:",
71
- "# <Name>",
72
- "## Purpose",
73
- "## Operating Mode (bullet list)",
74
- "## Tools (bullet list; mention existing CLI tools and constraints briefly)",
75
- "## Output Contract (what to return to main agent)",
76
- "Be concise, 120-160 words total."
77
- ].filter(Boolean).join("\n");
78
- }
79
- function getAgentsDir() {
80
- return AUTOHAND_PATHS.agents;
81
- }
82
- function slugify(input) {
83
- return input.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "") || "agent";
84
- }
85
- async function ensureUniqueFilename(name) {
86
- const base = slugify(name);
87
- const dir = getAgentsDir();
88
- let candidate = `${base}.md`;
89
- let counter = 1;
90
- while (await fs.pathExists(path.join(dir, candidate))) {
91
- candidate = `${base}-${counter}.md`;
92
- counter += 1;
93
- }
94
- return candidate;
95
- }
96
-
97
- export {
98
- metadata,
99
- createAgent
100
- };
101
- /**
102
- * @license
103
- * Copyright 2025 Autohand AI LLC
104
- * SPDX-License-Identifier: Apache-2.0
105
- */
@@ -1,131 +0,0 @@
1
- import {
2
- getAuthClient,
3
- saveConfig
4
- } from "./chunk-Y7FSNXMR.js";
5
- import {
6
- AUTH_CONFIG
7
- } from "./chunk-7FMMKTRG.js";
8
-
9
- // src/commands/login.ts
10
- import chalk from "chalk";
11
- import enquirer from "enquirer";
12
- var metadata = {
13
- command: "/login",
14
- description: "sign in to your Autohand account",
15
- implemented: true
16
- };
17
- async function openBrowser(url) {
18
- try {
19
- const open = await import("open").then((m) => m.default).catch(() => null);
20
- if (open) {
21
- await open(url);
22
- return true;
23
- }
24
- const { exec } = await import("child_process");
25
- const { promisify } = await import("util");
26
- const execAsync = promisify(exec);
27
- const platform = process.platform;
28
- let command;
29
- if (platform === "darwin") {
30
- command = `open "${url}"`;
31
- } else if (platform === "win32") {
32
- command = `start "" "${url}"`;
33
- } else {
34
- command = `xdg-open "${url}"`;
35
- }
36
- await execAsync(command);
37
- return true;
38
- } catch {
39
- return false;
40
- }
41
- }
42
- function sleep(ms) {
43
- return new Promise((resolve) => setTimeout(resolve, ms));
44
- }
45
- async function login(ctx) {
46
- const config = ctx.config;
47
- if (config?.auth?.token && config?.auth?.user) {
48
- const { continueLogin } = await enquirer.prompt({
49
- type: "confirm",
50
- name: "continueLogin",
51
- message: `Already logged in as ${chalk.cyan(config.auth.user.email)}. Log in with a different account?`,
52
- initial: false
53
- });
54
- if (!continueLogin) {
55
- console.log(chalk.gray("Login cancelled."));
56
- return null;
57
- }
58
- }
59
- const authClient = getAuthClient();
60
- console.log(chalk.gray("Initiating authentication..."));
61
- const initResult = await authClient.initiateDeviceAuth();
62
- if (!initResult.success || !initResult.deviceCode || !initResult.userCode) {
63
- console.log(chalk.red(`Failed to start login: ${initResult.error || "Unknown error"}`));
64
- return null;
65
- }
66
- console.log();
67
- console.log(chalk.bold("To sign in, visit:"));
68
- console.log(chalk.cyan.underline(initResult.verificationUriComplete || `${AUTH_CONFIG.authorizationUrl}?code=${initResult.userCode}`));
69
- console.log();
70
- console.log(chalk.gray("Or enter this code manually:"));
71
- console.log(chalk.bold.yellow(` ${initResult.userCode}`));
72
- console.log();
73
- const browserOpened = await openBrowser(
74
- initResult.verificationUriComplete || `${AUTH_CONFIG.authorizationUrl}?code=${initResult.userCode}`
75
- );
76
- if (browserOpened) {
77
- console.log(chalk.gray("Browser opened. Complete the login in your browser."));
78
- } else {
79
- console.log(chalk.yellow("Could not open browser automatically. Please visit the URL above."));
80
- }
81
- console.log();
82
- console.log(chalk.gray("Waiting for authorization..."));
83
- console.log(chalk.gray("(Press Ctrl+C to cancel)"));
84
- const startTime = Date.now();
85
- const timeout = AUTH_CONFIG.authTimeout;
86
- const pollInterval = initResult.interval ? initResult.interval * 1e3 : AUTH_CONFIG.pollInterval;
87
- let dots = 0;
88
- const maxDots = 3;
89
- while (Date.now() - startTime < timeout) {
90
- process.stdout.write(`\r${chalk.gray("Waiting" + ".".repeat(dots + 1) + " ".repeat(maxDots - dots))}`);
91
- dots = (dots + 1) % (maxDots + 1);
92
- await sleep(pollInterval);
93
- const pollResult = await authClient.pollDeviceAuth(initResult.deviceCode);
94
- if (pollResult.status === "authorized" && pollResult.token && pollResult.user) {
95
- process.stdout.write("\r" + " ".repeat(20) + "\r");
96
- const expiresAt = new Date(Date.now() + AUTH_CONFIG.sessionExpiryDays * 24 * 60 * 60 * 1e3).toISOString();
97
- const updatedConfig = {
98
- ...config,
99
- auth: {
100
- token: pollResult.token,
101
- user: pollResult.user,
102
- expiresAt
103
- }
104
- };
105
- await saveConfig(updatedConfig);
106
- console.log();
107
- console.log(chalk.green("Login successful!"));
108
- console.log(chalk.cyan(`Welcome, ${pollResult.user.name || pollResult.user.email}!`));
109
- console.log();
110
- return null;
111
- }
112
- if (pollResult.status === "expired") {
113
- process.stdout.write("\r" + " ".repeat(20) + "\r");
114
- console.log(chalk.red("Authorization code expired. Please try again."));
115
- return null;
116
- }
117
- }
118
- process.stdout.write("\r" + " ".repeat(20) + "\r");
119
- console.log(chalk.red("Authorization timed out. Please try again."));
120
- return null;
121
- }
122
-
123
- export {
124
- metadata,
125
- login
126
- };
127
- /**
128
- * @license
129
- * Copyright 2025 Autohand AI LLC
130
- * SPDX-License-Identifier: Apache-2.0
131
- */
@@ -1,57 +0,0 @@
1
- import {
2
- getAuthClient,
3
- saveConfig
4
- } from "./chunk-J7RENRJG.js";
5
-
6
- // src/commands/logout.ts
7
- import chalk from "chalk";
8
- import enquirer from "enquirer";
9
- var metadata = {
10
- command: "/logout",
11
- description: "sign out of your Autohand account",
12
- implemented: true
13
- };
14
- async function logout(ctx) {
15
- const config = ctx.config;
16
- if (!config?.auth?.token) {
17
- console.log(chalk.yellow("You are not currently logged in."));
18
- console.log(chalk.gray("Use /login to sign in to your Autohand account."));
19
- return null;
20
- }
21
- const userName = config.auth.user?.name || config.auth.user?.email || "user";
22
- const { confirm } = await enquirer.prompt({
23
- type: "confirm",
24
- name: "confirm",
25
- message: `Log out from ${chalk.cyan(userName)}?`,
26
- initial: true
27
- });
28
- if (!confirm) {
29
- console.log(chalk.gray("Logout cancelled."));
30
- return null;
31
- }
32
- const authClient = getAuthClient();
33
- try {
34
- await authClient.logout(config.auth.token);
35
- } catch {
36
- }
37
- const updatedConfig = {
38
- ...config,
39
- auth: void 0
40
- };
41
- await saveConfig(updatedConfig);
42
- console.log();
43
- console.log(chalk.green("Successfully logged out."));
44
- console.log(chalk.gray("Your local session has been cleared."));
45
- console.log();
46
- return null;
47
- }
48
-
49
- export {
50
- metadata,
51
- logout
52
- };
53
- /**
54
- * @license
55
- * Copyright 2025 Autohand AI LLC
56
- * SPDX-License-Identifier: Apache-2.0
57
- */
@@ -1,68 +0,0 @@
1
- // src/constants.ts
2
- import os from "os";
3
- import path from "path";
4
- var AUTOHAND_HOME = process.env.AUTOHAND_HOME || path.join(os.homedir(), ".autohand");
5
- var AUTOHAND_PATHS = {
6
- /** Configuration files (config.json, config.yaml, config.yml) */
7
- config: AUTOHAND_HOME,
8
- /** Session data storage */
9
- sessions: path.join(AUTOHAND_HOME, "sessions"),
10
- /** Project knowledge base */
11
- projects: path.join(AUTOHAND_HOME, "projects"),
12
- /** User-level memory */
13
- memory: path.join(AUTOHAND_HOME, "memory"),
14
- /** Feedback state and responses */
15
- feedback: path.join(AUTOHAND_HOME, "feedback"),
16
- /** Telemetry data */
17
- telemetry: path.join(AUTOHAND_HOME, "telemetry"),
18
- /** Custom commands */
19
- commands: path.join(AUTOHAND_HOME, "commands"),
20
- /** Agent definitions */
21
- agents: path.join(AUTOHAND_HOME, "agents"),
22
- /** Custom tools */
23
- tools: path.join(AUTOHAND_HOME, "tools")
24
- };
25
- var AUTOHAND_FILES = {
26
- /** Main config file */
27
- configJson: path.join(AUTOHAND_HOME, "config.json"),
28
- configYaml: path.join(AUTOHAND_HOME, "config.yaml"),
29
- configYml: path.join(AUTOHAND_HOME, "config.yml"),
30
- /** Device ID for telemetry */
31
- deviceId: path.join(AUTOHAND_HOME, "device-id"),
32
- /** Error log */
33
- errorLog: path.join(AUTOHAND_HOME, "error.log"),
34
- /** Feedback log */
35
- feedbackLog: path.join(AUTOHAND_HOME, "feedback.log"),
36
- /** Telemetry queue */
37
- telemetryQueue: path.join(AUTOHAND_PATHS.telemetry, "queue.json"),
38
- /** Session sync queue */
39
- sessionSyncQueue: path.join(AUTOHAND_PATHS.telemetry, "session-sync-queue.json")
40
- };
41
- var PROJECT_DIR_NAME = ".autohand";
42
- var AUTH_CONFIG = {
43
- /** Base URL for the authentication API */
44
- apiBaseUrl: "https://e2d1306c.autohand-web.pages.dev/api/auth",
45
- /** URL where users authorize CLI devices */
46
- authorizationUrl: "https://e2d1306c.autohand-web.pages.dev/cli-auth",
47
- /** Polling interval in milliseconds */
48
- pollInterval: 2e3,
49
- /** Timeout for device authorization in milliseconds (5 minutes) */
50
- authTimeout: 5 * 60 * 1e3,
51
- /** CLI session expiry in days */
52
- sessionExpiryDays: 30
53
- };
54
-
55
- export {
56
- AUTOHAND_HOME,
57
- AUTOHAND_PATHS,
58
- AUTOHAND_FILES,
59
- PROJECT_DIR_NAME,
60
- AUTH_CONFIG
61
- };
62
- /**
63
- * @license
64
- * Copyright 2025 Autohand AI LLC
65
- * SPDX-License-Identifier: Apache-2.0
66
- *
67
- * Centralized constants for Autohand CLI
68
- */
@@ -1,79 +0,0 @@
1
- import {
2
- AUTOHAND_FILES
3
- } from "./chunk-WTEZYXD2.js";
4
-
5
- // src/commands/feedback.ts
6
- import fs from "fs-extra";
7
- import chalk from "chalk";
8
- import enquirer from "enquirer";
9
- var metadata = {
10
- command: "/feedback",
11
- description: "share feedback with environment details",
12
- implemented: true
13
- };
14
- async function feedback(_ctx) {
15
- const answer = await enquirer.prompt([
16
- {
17
- type: "input",
18
- name: "feedback",
19
- message: "What worked? What broke?"
20
- }
21
- ]);
22
- if (!answer.feedback?.trim()) {
23
- console.log(chalk.gray("Feedback discarded (empty)."));
24
- return null;
25
- }
26
- const now = (/* @__PURE__ */ new Date()).toISOString();
27
- const runtimeError = getLastRuntimeError();
28
- const payload = {
29
- timestamp: now,
30
- feedback: answer.feedback.trim(),
31
- env: {
32
- platform: `${process.platform}-${process.arch}`,
33
- node: process.version,
34
- bun: process.versions?.bun,
35
- cwd: process.cwd(),
36
- shell: process.env.SHELL
37
- },
38
- runtimeError: runtimeError ? formatError(runtimeError) : null
39
- };
40
- try {
41
- const feedbackPath = AUTOHAND_FILES.feedbackLog;
42
- await fs.ensureFile(feedbackPath);
43
- await fs.appendFile(feedbackPath, JSON.stringify(payload) + "\n", "utf8");
44
- console.log(chalk.green("Feedback recorded."));
45
- console.log(chalk.gray(`Saved to ${feedbackPath}`));
46
- } catch (error) {
47
- console.error(chalk.red(`Failed to save feedback: ${error.message}`));
48
- }
49
- if (runtimeError) {
50
- console.log(chalk.yellow("Detected a recent runtime error; included in feedback payload."));
51
- }
52
- return null;
53
- }
54
- function getLastRuntimeError() {
55
- const globalAny = globalThis;
56
- return globalAny.__autohandLastError ?? null;
57
- }
58
- function formatError(err) {
59
- if (!err) return {};
60
- if (err instanceof Error) {
61
- return { message: err.message, stack: err.stack };
62
- }
63
- if (typeof err === "object") {
64
- const message = "message" in err ? String(err.message) : void 0;
65
- const stack = "stack" in err ? String(err.stack) : void 0;
66
- return { message, stack };
67
- }
68
- return { message: String(err) };
69
- }
70
-
71
- export {
72
- metadata,
73
- feedback
74
- };
75
- /**
76
- * @license
77
- * Copyright 2025 Autohand AI LLC
78
- * SPDX-License-Identifier: Apache-2.0
79
- */
@@ -1,57 +0,0 @@
1
- import {
2
- getAuthClient,
3
- saveConfig
4
- } from "./chunk-ZRFAICDG.js";
5
-
6
- // src/commands/logout.ts
7
- import chalk from "chalk";
8
- import enquirer from "enquirer";
9
- var metadata = {
10
- command: "/logout",
11
- description: "sign out of your Autohand account",
12
- implemented: true
13
- };
14
- async function logout(ctx) {
15
- const config = ctx.config;
16
- if (!config?.auth?.token) {
17
- console.log(chalk.yellow("You are not currently logged in."));
18
- console.log(chalk.gray("Use /login to sign in to your Autohand account."));
19
- return null;
20
- }
21
- const userName = config.auth.user?.name || config.auth.user?.email || "user";
22
- const { confirm } = await enquirer.prompt({
23
- type: "confirm",
24
- name: "confirm",
25
- message: `Log out from ${chalk.cyan(userName)}?`,
26
- initial: true
27
- });
28
- if (!confirm) {
29
- console.log(chalk.gray("Logout cancelled."));
30
- return null;
31
- }
32
- const authClient = getAuthClient();
33
- try {
34
- await authClient.logout(config.auth.token);
35
- } catch {
36
- }
37
- const updatedConfig = {
38
- ...config,
39
- auth: void 0
40
- };
41
- await saveConfig(updatedConfig);
42
- console.log();
43
- console.log(chalk.green("Successfully logged out."));
44
- console.log(chalk.gray("Your local session has been cleared."));
45
- console.log();
46
- return null;
47
- }
48
-
49
- export {
50
- metadata,
51
- logout
52
- };
53
- /**
54
- * @license
55
- * Copyright 2025 Autohand AI LLC
56
- * SPDX-License-Identifier: Apache-2.0
57
- */