@hasna/terminal 4.3.0 → 4.3.2

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 (58) hide show
  1. package/dist/Onboarding.js +1 -1
  2. package/dist/ai.js +9 -8
  3. package/dist/cache.js +2 -2
  4. package/dist/cli.js +0 -0
  5. package/dist/economy.js +3 -3
  6. package/dist/history.js +2 -2
  7. package/dist/mcp/server.js +26 -1345
  8. package/dist/mcp/tools/batch.js +111 -0
  9. package/dist/mcp/tools/execute.js +194 -0
  10. package/dist/mcp/tools/files.js +290 -0
  11. package/dist/mcp/tools/git.js +233 -0
  12. package/dist/mcp/tools/helpers.js +63 -0
  13. package/dist/mcp/tools/memory.js +151 -0
  14. package/dist/mcp/tools/meta.js +138 -0
  15. package/dist/mcp/tools/process.js +50 -0
  16. package/dist/mcp/tools/project.js +251 -0
  17. package/dist/mcp/tools/search.js +86 -0
  18. package/dist/output-store.js +2 -1
  19. package/dist/paths.js +28 -0
  20. package/dist/recipes/storage.js +3 -3
  21. package/dist/session-context.js +2 -2
  22. package/dist/sessions-db.js +15 -6
  23. package/dist/snapshots.js +2 -2
  24. package/dist/tool-profiles.js +4 -3
  25. package/dist/usage-cache.js +2 -2
  26. package/package.json +5 -3
  27. package/src/Onboarding.tsx +1 -1
  28. package/src/ai.ts +9 -8
  29. package/src/cache.ts +2 -2
  30. package/src/economy.ts +3 -3
  31. package/src/history.ts +2 -2
  32. package/src/mcp/server.ts +28 -1704
  33. package/src/mcp/tools/batch.ts +106 -0
  34. package/src/mcp/tools/execute.ts +248 -0
  35. package/src/mcp/tools/files.ts +369 -0
  36. package/src/mcp/tools/git.ts +306 -0
  37. package/src/mcp/tools/helpers.ts +92 -0
  38. package/src/mcp/tools/memory.ts +172 -0
  39. package/src/mcp/tools/meta.ts +202 -0
  40. package/src/mcp/tools/process.ts +94 -0
  41. package/src/mcp/tools/project.ts +297 -0
  42. package/src/mcp/tools/search.ts +118 -0
  43. package/src/output-store.ts +2 -1
  44. package/src/paths.ts +32 -0
  45. package/src/recipes/storage.ts +3 -3
  46. package/src/session-context.ts +2 -2
  47. package/src/sessions-db.ts +15 -4
  48. package/src/snapshots.ts +2 -2
  49. package/src/tool-profiles.ts +4 -3
  50. package/src/usage-cache.ts +2 -2
  51. package/dist/output-router.js +0 -41
  52. package/dist/parsers/base.js +0 -2
  53. package/dist/parsers/build.js +0 -64
  54. package/dist/parsers/errors.js +0 -101
  55. package/dist/parsers/files.js +0 -78
  56. package/dist/parsers/git.js +0 -99
  57. package/dist/parsers/index.js +0 -48
  58. package/dist/parsers/tests.js +0 -89
@@ -47,5 +47,5 @@ export default function Onboarding({ onDone }) {
47
47
  const active = cursor === i;
48
48
  const on = perms[p.key];
49
49
  return (_jsxs(Box, { gap: 2, children: [_jsx(Text, { dimColor: true, children: active ? "›" : " " }), _jsx(Text, { color: on ? undefined : "red", children: on ? "✓" : "✗" }), _jsx(Text, { bold: active, children: p.label }), _jsx(Text, { dimColor: true, children: p.hint })] }, p.key));
50
- }) }), _jsx(Box, { marginTop: 1, children: _jsx(Text, { dimColor: true, children: "space toggle \u00B7 enter confirm" }) }), _jsx(Text, { dimColor: true, children: "edit later: ~/.terminal/config.json" })] }));
50
+ }) }), _jsx(Box, { marginTop: 1, children: _jsx(Text, { dimColor: true, children: "space toggle \u00B7 enter confirm" }) }), _jsx(Text, { dimColor: true, children: "edit later: ~/.hasna/terminal/config.json" })] }));
51
51
  }
package/dist/ai.js CHANGED
@@ -2,9 +2,10 @@ import { cacheGet, cacheSet } from "./cache.js";
2
2
  import { getProvider } from "./providers/index.js";
3
3
  import { existsSync, readFileSync } from "fs";
4
4
  import { join } from "path";
5
+ import { getTerminalDir } from "./paths.js";
5
6
  import { discoverProjectHints, discoverSafetyHints, formatHints } from "./context-hints.js";
6
7
  // ── model routing ─────────────────────────────────────────────────────────────
7
- // Config-driven model selection. Defaults per provider, user can override in ~/.terminal/config.json
8
+ // Config-driven model selection. Defaults per provider, user can override in ~/.hasna/terminal/config.json
8
9
  const COMPLEX_SIGNALS = [
9
10
  /\b(undo|revert|rollback|previous|last)\b/i,
10
11
  /\b(all files?|recursively|bulk|batch)\b/i,
@@ -14,14 +15,14 @@ const COMPLEX_SIGNALS = [
14
15
  /\b(inside|within|under)\b/i,
15
16
  /[|&;]{2}/,
16
17
  ];
17
- /** Default models per provider — user can override in ~/.terminal/config.json under "models" */
18
+ /** Default models per provider — user can override in ~/.hasna/terminal/config.json under "models" */
18
19
  const MODEL_DEFAULTS = {
19
20
  cerebras: { fast: "qwen-3-235b-a22b-instruct-2507", smart: "qwen-3-235b-a22b-instruct-2507" },
20
21
  groq: { fast: "openai/gpt-oss-120b", smart: "moonshotai/kimi-k2-instruct" },
21
22
  xai: { fast: "grok-code-fast-1", smart: "grok-4-fast-non-reasoning" },
22
23
  anthropic: { fast: "claude-haiku-4-5-20251001", smart: "claude-sonnet-4-6" },
23
24
  };
24
- /** Load user model overrides from ~/.terminal/config.json (cached 30s) */
25
+ /** Load user model overrides from ~/.hasna/terminal/config.json (cached 30s) */
25
26
  let _modelOverrides = null;
26
27
  let _modelOverridesAt = 0;
27
28
  function loadModelOverrides() {
@@ -29,7 +30,7 @@ function loadModelOverrides() {
29
30
  if (_modelOverrides && now - _modelOverridesAt < 30_000)
30
31
  return _modelOverrides;
31
32
  try {
32
- const configPath = join(process.env.HOME ?? "~", ".terminal", "config.json");
33
+ const configPath = join(getTerminalDir(), "config.json");
33
34
  if (existsSync(configPath)) {
34
35
  const config = JSON.parse(readFileSync(configPath, "utf8"));
35
36
  _modelOverrides = config.models ?? {};
@@ -182,9 +183,9 @@ function buildSystemPrompt(perms, sessionEntries, currentPrompt) {
182
183
  list files in current directory → ls
183
184
  list all files including hidden → ls -a
184
185
  show open files → lsof
185
- create copy of a.txt as b.txt cp a.txt b.txt
186
- create file test.txttouch test.txt
187
- make directory testdirmkdir testdir
186
+ show file sizedu -sh file
187
+ show file typefile filename
188
+ show file permissionsls -la file
188
189
  display routing table → route
189
190
  show last logged in users → last
190
191
  show file stats → stat file
@@ -202,7 +203,7 @@ system utilization stats → vmstat
202
203
  DNS servers → cat /etc/resolv.conf | grep nameserver
203
204
  long integer size → getconf LONG_BIT
204
205
  base64 decode string → echo 'str' | base64 -d
205
- change owner to nobody chown nobody file
206
+ show file owner → ls -la file
206
207
  unique lines in file → uniq file
207
208
  max cpu time → ulimit -t
208
209
  memory info → lsmem
package/dist/cache.js CHANGED
@@ -1,8 +1,8 @@
1
1
  // In-memory LRU cache + disk persistence for command translations
2
2
  import { existsSync, readFileSync, writeFileSync } from "fs";
3
- import { homedir } from "os";
4
3
  import { join } from "path";
5
- const CACHE_FILE = join(homedir(), ".terminal", "cache.json");
4
+ import { getTerminalDir } from "./paths.js";
5
+ const CACHE_FILE = join(getTerminalDir(), "cache.json");
6
6
  const MAX_ENTRIES = 500;
7
7
  let mem = {};
8
8
  export function loadCache() {
package/dist/cli.js CHANGED
File without changes
package/dist/economy.js CHANGED
@@ -1,8 +1,8 @@
1
1
  // Token economy tracker — tracks token savings across all interactions
2
2
  import { existsSync, readFileSync, writeFileSync, mkdirSync } from "fs";
3
- import { homedir } from "os";
4
3
  import { join } from "path";
5
- const DIR = join(homedir(), ".terminal");
4
+ import { getTerminalDir } from "./paths.js";
5
+ const DIR = getTerminalDir();
6
6
  const ECONOMY_FILE = join(DIR, "economy.json");
7
7
  let stats = null;
8
8
  function ensureDir() {
@@ -106,7 +106,7 @@ const PROVIDER_PRICING = {
106
106
  "anthropic-sonnet": { input: 3.00, output: 15.00 },
107
107
  "anthropic-opus": { input: 5.00, output: 25.00 },
108
108
  };
109
- /** Load configurable turns-before-compaction from ~/.terminal/config.json */
109
+ /** Load configurable turns-before-compaction from ~/.hasna/terminal/config.json */
110
110
  function loadTurnsMultiplier() {
111
111
  try {
112
112
  const configPath = join(DIR, "config.json");
package/dist/history.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { existsSync, mkdirSync, readFileSync, writeFileSync } from "fs";
2
- import { homedir } from "os";
3
2
  import { join } from "path";
4
- const DIR = join(homedir(), ".terminal");
3
+ import { getTerminalDir } from "./paths.js";
4
+ const DIR = getTerminalDir();
5
5
  const HISTORY_FILE = join(DIR, "history.json");
6
6
  const CONFIG_FILE = join(DIR, "config.json");
7
7
  export const DEFAULT_PERMISSIONS = {