@halfagiraf/clawx 0.1.0

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 (69) hide show
  1. package/.env.example +44 -0
  2. package/LICENSE +21 -0
  3. package/README.md +489 -0
  4. package/clawx.json.example +23 -0
  5. package/dist/cli/main.d.ts +21 -0
  6. package/dist/cli/main.d.ts.map +1 -0
  7. package/dist/cli/main.js +176 -0
  8. package/dist/cli/main.js.map +1 -0
  9. package/dist/cli/repl.d.ts +11 -0
  10. package/dist/cli/repl.d.ts.map +1 -0
  11. package/dist/cli/repl.js +119 -0
  12. package/dist/cli/repl.js.map +1 -0
  13. package/dist/cli/tui.d.ts +35 -0
  14. package/dist/cli/tui.d.ts.map +1 -0
  15. package/dist/cli/tui.js +92 -0
  16. package/dist/cli/tui.js.map +1 -0
  17. package/dist/config/index.d.ts +9 -0
  18. package/dist/config/index.d.ts.map +1 -0
  19. package/dist/config/index.js +106 -0
  20. package/dist/config/index.js.map +1 -0
  21. package/dist/core/agent.d.ts +53 -0
  22. package/dist/core/agent.d.ts.map +1 -0
  23. package/dist/core/agent.js +152 -0
  24. package/dist/core/agent.js.map +1 -0
  25. package/dist/core/provider.d.ts +30 -0
  26. package/dist/core/provider.d.ts.map +1 -0
  27. package/dist/core/provider.js +76 -0
  28. package/dist/core/provider.js.map +1 -0
  29. package/dist/core/session.d.ts +37 -0
  30. package/dist/core/session.d.ts.map +1 -0
  31. package/dist/core/session.js +87 -0
  32. package/dist/core/session.js.map +1 -0
  33. package/dist/core/streaming.d.ts +27 -0
  34. package/dist/core/streaming.d.ts.map +1 -0
  35. package/dist/core/streaming.js +137 -0
  36. package/dist/core/streaming.js.map +1 -0
  37. package/dist/index.d.ts +18 -0
  38. package/dist/index.d.ts.map +1 -0
  39. package/dist/index.js +18 -0
  40. package/dist/index.js.map +1 -0
  41. package/dist/tools/gitDiff.d.ts +13 -0
  42. package/dist/tools/gitDiff.d.ts.map +1 -0
  43. package/dist/tools/gitDiff.js +50 -0
  44. package/dist/tools/gitDiff.js.map +1 -0
  45. package/dist/tools/gitStatus.d.ts +13 -0
  46. package/dist/tools/gitStatus.d.ts.map +1 -0
  47. package/dist/tools/gitStatus.js +43 -0
  48. package/dist/tools/gitStatus.js.map +1 -0
  49. package/dist/tools/searchFiles.d.ts +19 -0
  50. package/dist/tools/searchFiles.d.ts.map +1 -0
  51. package/dist/tools/searchFiles.js +101 -0
  52. package/dist/tools/searchFiles.js.map +1 -0
  53. package/dist/tools/sshRun.d.ts +26 -0
  54. package/dist/tools/sshRun.d.ts.map +1 -0
  55. package/dist/tools/sshRun.js +170 -0
  56. package/dist/tools/sshRun.js.map +1 -0
  57. package/dist/types/index.d.ts +35 -0
  58. package/dist/types/index.d.ts.map +1 -0
  59. package/dist/types/index.js +8 -0
  60. package/dist/types/index.js.map +1 -0
  61. package/dist/utils/logger.d.ts +19 -0
  62. package/dist/utils/logger.d.ts.map +1 -0
  63. package/dist/utils/logger.js +43 -0
  64. package/dist/utils/logger.js.map +1 -0
  65. package/dist/utils/system-prompt.d.ts +9 -0
  66. package/dist/utils/system-prompt.d.ts.map +1 -0
  67. package/dist/utils/system-prompt.js +49 -0
  68. package/dist/utils/system-prompt.js.map +1 -0
  69. package/package.json +71 -0
@@ -0,0 +1,49 @@
1
+ /**
2
+ * System prompt builder for Clawx.
3
+ *
4
+ * Builds a focused system prompt for coding/execution tasks.
5
+ * No personality systems, no lore, no bootstrap documents.
6
+ */
7
+ export function buildSystemPrompt(config) {
8
+ const sshSection = Object.keys(config.sshTargets).length > 0
9
+ ? `\n\nSSH Targets available:\n${Object.entries(config.sshTargets)
10
+ .map(([name, t]) => `- "${name}": ${t.username}@${t.host}${t.port ? `:${t.port}` : ""}`)
11
+ .join("\n")}`
12
+ : "";
13
+ return `You are Clawx, a coding and execution agent. You help users build software by creating files, writing code, running commands, and iterating based on results.
14
+
15
+ Environment:
16
+ - Working directory: ${config.workDir}
17
+ - Platform: ${process.platform}
18
+ - Shell: ${config.shell}${sshSection}
19
+
20
+ Behavior:
21
+ - You are action-oriented. When asked to build something, start building immediately.
22
+ - You decide what files to create, what structure to use, and what code to write.
23
+ - You run commands to install dependencies, build, test, and verify your work.
24
+ - You iterate based on command output — if something fails, you fix it and try again.
25
+ - You are concise. Show your work through actions, not lengthy explanations.
26
+ - You do not ask permission before creating files or running commands — that is your purpose.
27
+
28
+ Capabilities:
29
+ - read_file: Read file contents
30
+ - write_file: Write/create files with content
31
+ - edit_file: Make precise edits to existing files (search and replace)
32
+ - list_dir: List directory contents
33
+ - search_files: Search file contents with patterns
34
+ - run_shell: Execute shell commands locally
35
+ - ssh_run: Execute commands on remote SSH targets
36
+ - git_status: Check git repository status
37
+ - git_diff: View git diffs
38
+
39
+ When building applications:
40
+ 1. Plan the file structure
41
+ 2. Create files with proper code
42
+ 3. Install dependencies
43
+ 4. Build/compile if needed
44
+ 5. Test and verify
45
+ 6. Report results
46
+
47
+ ${config.systemPrompt || ""}`.trim();
48
+ }
49
+ //# sourceMappingURL=system-prompt.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"system-prompt.js","sourceRoot":"","sources":["../../src/utils/system-prompt.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,MAAM,UAAU,iBAAiB,CAAC,MAAmB;IACnD,MAAM,UAAU,GAAG,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC,MAAM,GAAG,CAAC;QAC1D,CAAC,CAAC,+BAA+B,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,UAAU,CAAC;aAC7D,GAAG,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAsB,EAAE,EAAE,CAAC,MAAM,IAAI,MAAM,CAAC,CAAC,QAAQ,IAAI,CAAC,CAAC,IAAI,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC;aAC5G,IAAI,CAAC,IAAI,CAAC,EAAE;QACjB,CAAC,CAAC,EAAE,CAAC;IAEP,OAAO;;;uBAGc,MAAM,CAAC,OAAO;cACvB,OAAO,CAAC,QAAQ;WACnB,MAAM,CAAC,KAAK,GAAG,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA6BlC,MAAM,CAAC,YAAY,IAAI,EAAE,EAAE,CAAC,IAAI,EAAE,CAAC;AACrC,CAAC"}
package/package.json ADDED
@@ -0,0 +1,71 @@
1
+ {
2
+ "name": "@halfagiraf/clawx",
3
+ "version": "0.1.0",
4
+ "description": "Terminal-first coding agent — runs locally with Ollama, DeepSeek, OpenAI, or any OpenAI-compatible endpoint",
5
+ "type": "module",
6
+ "bin": {
7
+ "clawx": "./dist/cli/main.js"
8
+ },
9
+ "main": "./dist/index.js",
10
+ "types": "./dist/index.d.ts",
11
+ "files": [
12
+ "dist/",
13
+ "README.md",
14
+ "LICENSE",
15
+ ".env.example",
16
+ "clawx.json.example"
17
+ ],
18
+ "scripts": {
19
+ "build": "tsc",
20
+ "dev": "tsc --watch",
21
+ "start": "node dist/cli/main.js",
22
+ "test": "vitest --run",
23
+ "lint": "tsc --noEmit",
24
+ "prepublishOnly": "npm run build && npm test"
25
+ },
26
+ "engines": {
27
+ "node": ">=22.0.0"
28
+ },
29
+ "repository": {
30
+ "type": "git",
31
+ "url": "git+https://github.com/stevenmcsorley/clawx.git"
32
+ },
33
+ "homepage": "https://github.com/stevenmcsorley/clawx#readme",
34
+ "bugs": {
35
+ "url": "https://github.com/stevenmcsorley/clawx/issues"
36
+ },
37
+ "keywords": [
38
+ "coding-agent",
39
+ "ai-agent",
40
+ "terminal",
41
+ "cli",
42
+ "ollama",
43
+ "deepseek",
44
+ "openai",
45
+ "local-llm",
46
+ "code-generation",
47
+ "tool-calling",
48
+ "ssh",
49
+ "automation"
50
+ ],
51
+ "author": "Steven McSorley",
52
+ "dependencies": {
53
+ "@mariozechner/pi-agent-core": "^0.58.0",
54
+ "@mariozechner/pi-ai": "^0.58.0",
55
+ "@mariozechner/pi-coding-agent": "^0.58.0",
56
+ "@sinclair/typebox": "^0.34.0",
57
+ "chalk": "^5.4.0",
58
+ "commander": "^13.0.0",
59
+ "dotenv": "^16.4.0",
60
+ "ora": "^8.1.0",
61
+ "ssh2": "^1.16.0",
62
+ "zod": "^3.24.0"
63
+ },
64
+ "devDependencies": {
65
+ "@types/node": "^22.0.0",
66
+ "@types/ssh2": "^1.15.0",
67
+ "typescript": "^5.7.0",
68
+ "vitest": "^3.0.0"
69
+ },
70
+ "license": "MIT"
71
+ }