@c4ccz/zero 1.0.0 → 1.0.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.
Files changed (47) hide show
  1. package/package.json +10 -7
  2. package/packages/core/src/agent/config-loader.ts +174 -0
  3. package/packages/core/src/agent/engine.ts +266 -0
  4. package/packages/core/src/agent/registry-tools.ts +58 -0
  5. package/packages/core/src/agent/registry.ts +213 -0
  6. package/packages/core/src/commands/index.ts +116 -0
  7. package/packages/core/src/config/index.ts +139 -0
  8. package/packages/core/src/confirmation/message-bus.ts +206 -0
  9. package/packages/core/src/diff/index.ts +232 -0
  10. package/packages/core/src/diff-detect/index.ts +207 -0
  11. package/packages/core/src/edit-coder/index.ts +194 -0
  12. package/packages/core/src/events/index.ts +151 -0
  13. package/packages/core/src/file-tracker/index.ts +183 -0
  14. package/packages/core/src/git/index.ts +305 -0
  15. package/packages/core/src/history/index.ts +236 -0
  16. package/packages/core/src/image/index.ts +131 -0
  17. package/packages/core/src/index.ts +131 -0
  18. package/packages/core/src/lsp/index.ts +251 -0
  19. package/packages/core/src/mcp/index.ts +186 -0
  20. package/packages/core/src/memory/index.ts +141 -0
  21. package/packages/core/src/memory/prompts.ts +52 -0
  22. package/packages/core/src/orchestrator/protocol.ts +140 -0
  23. package/packages/core/src/orchestrator/server.ts +319 -0
  24. package/packages/core/src/output/index.ts +164 -0
  25. package/packages/core/src/permissions/index.ts +126 -0
  26. package/packages/core/src/prompts/engine.ts +188 -0
  27. package/packages/core/src/providers/extended.ts +8 -0
  28. package/packages/core/src/providers/registry.ts +687 -0
  29. package/packages/core/src/routing/model-router.ts +160 -0
  30. package/packages/core/src/server/index.ts +232 -0
  31. package/packages/core/src/session/index.ts +174 -0
  32. package/packages/core/src/session/service.ts +322 -0
  33. package/packages/core/src/skills/index.ts +205 -0
  34. package/packages/core/src/streaming/index.ts +166 -0
  35. package/packages/core/src/sub-agent/index.ts +179 -0
  36. package/packages/core/src/tools/builtin.ts +568 -0
  37. package/packages/core/src/tools/linter.ts +26 -0
  38. package/packages/core/src/tools/repo-map.ts +11 -0
  39. package/packages/core/src/types.ts +356 -0
  40. package/packages/sdk/src/index.ts +247 -0
  41. package/packages/tui/src/index.ts +141 -0
  42. package/bun.lock +0 -35
  43. package/bunfig.toml +0 -6
  44. package/packages/cli/package.json +0 -23
  45. package/packages/core/package.json +0 -41
  46. package/packages/sdk/package.json +0 -16
  47. package/packages/tui/package.json +0 -19
@@ -0,0 +1,141 @@
1
+ /**
2
+ * ZERO TUI - Terminal User Interface
3
+ * Modern terminal UI built with Ink (React for CLI)
4
+ *
5
+ * Inspired by:
6
+ * - crush: Bubbletea-based TUI with diff view
7
+ * - pi: TUI with agent modes
8
+ * - opencode: Rich terminal interface
9
+ */
10
+
11
+ import chalk from "chalk";
12
+
13
+ export interface TUIOptions {
14
+ theme: "dark" | "light";
15
+ showLineNumbers: boolean;
16
+ syntaxHighlight: boolean;
17
+ }
18
+
19
+ export const DEFAULT_TUI_OPTIONS: TUIOptions = {
20
+ theme: "dark",
21
+ showLineNumbers: true,
22
+ syntaxHighlight: true,
23
+ };
24
+
25
+ /**
26
+ * ZERO Logo for terminal display
27
+ */
28
+ export const ZERO_LOGO = `
29
+ ${chalk.bold.hex("#8B5CF6")("███████╗███████╗██████╗ ██████╗ ")}
30
+ ${chalk.bold.hex("#8B5CF6")("╚══███╔╝██╔════╝██╔══██╗██╔═══██╗")}
31
+ ${chalk.bold.hex("#8B5CF6")(" ███╔╝ █████╗ ██████╔╝██║ ██║")}
32
+ ${chalk.bold.hex("#8B5CF6")(" ███╔╝ ██╔══╝ ██╔══██╗██║ ██║")}
33
+ ${chalk.bold.hex("#8B5CF6")("███████╗███████╗██║ ██║╚██████╔╝")}
34
+ ${chalk.bold.hex("#8B5CF6")("╚══════╝╚══════╝╚═╝ ╚═╝ ╚═════╝ ")}
35
+ ${chalk.gray(" Unified AI Coding Assistant v1.0.0")}
36
+ `;
37
+
38
+ /**
39
+ * Theme colors
40
+ */
41
+ export const THEME = {
42
+ dark: {
43
+ primary: "#8B5CF6", // Purple
44
+ secondary: "#06B6D4", // Cyan
45
+ success: "#10B981", // Green
46
+ warning: "#F59E0B", // Amber
47
+ error: "#EF4444", // Red
48
+ text: "#F9FAFB", // Near white
49
+ muted: "#9CA3AF", // Gray
50
+ background: "#1F2937", // Dark gray
51
+ border: "#374151", // Border gray
52
+ accent: "#EC4899", // Pink
53
+ },
54
+ light: {
55
+ primary: "#7C3AED",
56
+ secondary: "#0891B2",
57
+ success: "#059669",
58
+ warning: "#D97706",
59
+ error: "#DC2626",
60
+ text: "#111827",
61
+ muted: "#6B7280",
62
+ background: "#F9FAFB",
63
+ border: "#E5E7EB",
64
+ accent: "#DB2777",
65
+ },
66
+ };
67
+
68
+ /**
69
+ * Render a code block with syntax highlighting
70
+ */
71
+ export function renderCodeBlock(code: string, language = "text"): string {
72
+ const lines = code.split("\n");
73
+ const maxLineNum = String(lines.length).length;
74
+
75
+ return lines
76
+ .map((line, i) => {
77
+ const lineNum = chalk.gray(String(i + 1).padStart(maxLineNum));
78
+ return `${lineNum} ${chalk.gray("│")} ${colorize(line, language)}`;
79
+ })
80
+ .join("\n");
81
+ }
82
+
83
+ /**
84
+ * Simple syntax highlighting
85
+ */
86
+ function colorize(line: string, language: string): string {
87
+ // Keywords
88
+ const keywords = /\b(const|let|var|function|class|import|export|return|if|else|for|while|try|catch|async|await|new|this|type|interface|enum|extends|implements|public|private|protected|static|readonly)\b/g;
89
+ // Strings
90
+ const strings = /(["'`])(?:(?!\1|\\).|\\.)*\1/g;
91
+ // Comments
92
+ const comments = /(\/\/.*$|\/\*[\s\S]*?\*\/)/g;
93
+ // Numbers
94
+ const numbers = /\b(\d+\.?\d*)\b/g;
95
+
96
+ let result = line;
97
+ result = result.replace(comments, (m) => chalk.green(m));
98
+ result = result.replace(strings, (m) => chalk.yellow(m));
99
+ result = result.replace(keywords, (m) => chalk.hex("#8B5CF6")(m));
100
+ result = result.replace(numbers, (m) => chalk.cyan(m));
101
+
102
+ return result;
103
+ }
104
+
105
+ /**
106
+ * Render a diff view
107
+ */
108
+ export function renderDiff(diff: { blocks: Array<{ type: string; content: string; lineNumber: number }> }): string {
109
+ return diff.blocks
110
+ .map((block) => {
111
+ switch (block.type) {
112
+ case "add":
113
+ return chalk.green(`+ ${block.content}`);
114
+ case "remove":
115
+ return chalk.red(`- ${block.content}`);
116
+ case "context":
117
+ return chalk.gray(` ${block.content}`);
118
+ default:
119
+ return block.content;
120
+ }
121
+ })
122
+ .join("\n");
123
+ }
124
+
125
+ /**
126
+ * Render a status bar
127
+ */
128
+ export function renderStatusBar(info: {
129
+ model: string;
130
+ tokens: { input: number; output: number };
131
+ agent: string;
132
+ session: string;
133
+ }): string {
134
+ const left = chalk.hex("#8B5CF6")(` 🤖 ${info.agent} `) +
135
+ chalk.gray(`| 🌐 ${info.model} `);
136
+
137
+ const right = chalk.gray(` 📊 ${info.tokens.input}/${info.tokens.output} tokens `) +
138
+ chalk.hex("#8B5CF6")(` 📋 ${info.session.slice(0, 12)} `);
139
+
140
+ return `\n${left}${chalk.gray("─".repeat(Math.max(0, 60 - left.length - right.length)))}${right}`;
141
+ }
package/bun.lock DELETED
@@ -1,35 +0,0 @@
1
- {
2
- "lockfileVersion": 1,
3
- "configVersion": 1,
4
- "workspaces": {
5
- "": {
6
- "name": "zero",
7
- "dependencies": {
8
- "chalk": "^5.3.0",
9
- "commander": "^12.1.0",
10
- "zod": "^3.23.0",
11
- },
12
- "devDependencies": {
13
- "@types/bun": "latest",
14
- "typescript": "^5.5.0",
15
- },
16
- },
17
- },
18
- "packages": {
19
- "@types/bun": ["@types/bun@1.3.14", "", { "dependencies": { "bun-types": "1.3.14" } }, "sha512-h1hFqFVcvAvD9j9K7ZW7vd82aSA+rTdznZa+5bwvCwqSB1jmmfLcbIWhOLx1/+boy/xmjgCs/OMUL8hRJSmnPw=="],
20
-
21
- "@types/node": ["@types/node@26.1.1", "", { "dependencies": { "undici-types": "~8.3.0" } }, "sha512-nxAkRSVkN1Y0JC1W8ky/fTfkGsMmcrRsbx+3XoZE+rMOX71kLYTV7fLXpqud1GpbpP5TuffXFqfX7fH2GgZREw=="],
22
-
23
- "bun-types": ["bun-types@1.3.14", "", { "dependencies": { "@types/node": "*" } }, "sha512-4N0ig0fEomHt5R0KCFWjovxow98rIoRwKolrYdCcknNwMekCXRnWEUvgu5soYV8QXtVsrUD8B95MBOZGPvr6KQ=="],
24
-
25
- "chalk": ["chalk@5.6.2", "", {}, "sha512-7NzBL0rN6fMUW+f7A6Io4h40qQlG+xGmtMxfbnH/K7TAtt8JQWVQK+6g0UXKMeVJoyV5EkkNsErQ8pVD3bLHbA=="],
26
-
27
- "commander": ["commander@12.1.0", "", {}, "sha512-Vw8qHK3bZM9y/P10u3Vib8o/DdkvA2OtPtZvD871QKjy74Wj1WSKFILMPRPSdUSx5RFK1arlJzEtA4PkFgnbuA=="],
28
-
29
- "typescript": ["typescript@5.9.3", "", { "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" } }, "sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw=="],
30
-
31
- "undici-types": ["undici-types@8.3.0", "", {}, "sha512-j375ScV60dom+YkPFIfTLcOiPxkN/buHz5GobjLhixFuANaNs3C9l4GmrWqejgXWJ7BbJcFYpTEUkS1Ge8bpZQ=="],
32
-
33
- "zod": ["zod@3.25.76", "", {}, "sha512-gzUt/qt81nXsFGKIFcC3YnfEAx5NkunCfnDlvuBSSFS02bcXu4Lmea0AFIUwbLWxWPx3d9p8S5QoaujKcNQxcQ=="],
34
- }
35
- }
package/bunfig.toml DELETED
@@ -1,6 +0,0 @@
1
- [install]
2
- peer = false
3
-
4
- [test]
5
- coverage = true
6
- coverageReporter = ["text", "lcov"]
@@ -1,23 +0,0 @@
1
- {
2
- "name": "@zero/cli",
3
- "version": "1.0.0",
4
- "description": "ZERO CLI - Command Line Interface",
5
- "type": "module",
6
- "bin": {
7
- "zero": "./src/index.ts"
8
- },
9
- "scripts": {
10
- "dev": "bun run --watch src/index.ts",
11
- "build": "bun build ./src/index.ts --outdir ./dist --target node",
12
- "test": "bun test",
13
- "lint": "echo 'lint ok'",
14
- "clean": "rm -rf dist"
15
- },
16
- "dependencies": {
17
- "@zero/core": "workspace:*",
18
- "chalk": "^5.3.0",
19
- "commander": "^12.1.0",
20
- "inquirer": "^9.3.0",
21
- "ora": "^8.1.0"
22
- }
23
- }
@@ -1,41 +0,0 @@
1
- {
2
- "name": "@zero/core",
3
- "version": "1.0.0",
4
- "description": "ZERO Core - Unified AI Agent Engine",
5
- "type": "module",
6
- "main": "./src/index.ts",
7
- "types": "./src/index.ts",
8
- "exports": {
9
- ".": "./src/index.ts",
10
- "./agent": "./src/agent/index.ts",
11
- "./tools": "./src/tools/index.ts",
12
- "./providers": "./src/providers/index.ts",
13
- "./permissions": "./src/permissions/index.ts",
14
- "./session": "./src/session/index.ts",
15
- "./memory": "./src/memory/index.ts",
16
- "./context": "./src/context/index.ts",
17
- "./mcp": "./src/mcp/index.ts",
18
- "./config": "./src/config/index.ts",
19
- "./diff": "./src/diff/index.ts",
20
- "./utils": "./src/utils/index.ts"
21
- },
22
- "scripts": {
23
- "build": "bun build ./src/index.ts --outdir ./dist --target node",
24
- "test": "bun test",
25
- "lint": "echo 'lint ok'",
26
- "clean": "rm -rf dist"
27
- },
28
- "dependencies": {
29
- "zod": "^3.23.0",
30
- "eventemitter3": "^5.0.1",
31
- "diff": "^7.0.0",
32
- "glob": "^11.0.0",
33
- "minimatch": "^10.0.0",
34
- "chalk": "^5.3.0",
35
- "p-limit": "^6.1.0"
36
- },
37
- "devDependencies": {
38
- "@types/bun": "latest",
39
- "typescript": "^5.5.0"
40
- }
41
- }
@@ -1,16 +0,0 @@
1
- {
2
- "name": "@zero/sdk",
3
- "version": "1.0.0",
4
- "description": "ZERO SDK - Programmatic access to ZERO",
5
- "type": "module",
6
- "main": "./src/index.ts",
7
- "scripts": {
8
- "build": "bun build ./src/index.ts --outdir ./dist --target node",
9
- "test": "bun test",
10
- "lint": "echo 'lint ok'",
11
- "clean": "rm -rf dist"
12
- },
13
- "dependencies": {
14
- "@zero/core": "workspace:*"
15
- }
16
- }
@@ -1,19 +0,0 @@
1
- {
2
- "name": "@zero/tui",
3
- "version": "1.0.0",
4
- "description": "ZERO TUI - Terminal User Interface",
5
- "type": "module",
6
- "main": "./src/index.ts",
7
- "scripts": {
8
- "build": "bun build ./src/index.ts --outdir ./dist --target node",
9
- "test": "bun test",
10
- "lint": "echo 'lint ok'",
11
- "clean": "rm -rf dist"
12
- },
13
- "dependencies": {
14
- "@zero/core": "workspace:*",
15
- "ink": "^5.0.0",
16
- "react": "^18.3.0",
17
- "chalk": "^5.3.0"
18
- }
19
- }