ideacode 1.0.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.
- package/README.md +63 -0
- package/dist/api.js +54 -0
- package/dist/commands.js +43 -0
- package/dist/config.js +68 -0
- package/dist/context.js +39 -0
- package/dist/index.js +19 -0
- package/dist/onboarding.js +57 -0
- package/dist/repl.js +897 -0
- package/dist/tools/bash.js +27 -0
- package/dist/tools/file.js +43 -0
- package/dist/tools/index.js +80 -0
- package/dist/tools/search.js +86 -0
- package/dist/tools/types.js +1 -0
- package/dist/tools/web-search.test.js +114 -0
- package/dist/tools/web.js +147 -0
- package/dist/ui/format.js +65 -0
- package/dist/ui/index.js +1 -0
- package/dist/ui/theme.js +129 -0
- package/package.json +40 -0
package/dist/ui/theme.js
ADDED
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
import chalk from "chalk";
|
|
2
|
+
const ICONS = {
|
|
3
|
+
prompt: "▸",
|
|
4
|
+
agent: ">",
|
|
5
|
+
tool: "◆",
|
|
6
|
+
success: "✓",
|
|
7
|
+
error: "✗",
|
|
8
|
+
clear: "◎",
|
|
9
|
+
pipe: "│",
|
|
10
|
+
branch: "├",
|
|
11
|
+
leaf: "└",
|
|
12
|
+
selected: "›",
|
|
13
|
+
unselected: " ",
|
|
14
|
+
};
|
|
15
|
+
const THEME_DARK = {
|
|
16
|
+
name: "matcha-dark",
|
|
17
|
+
description: "Matcha green theme for dark terminals",
|
|
18
|
+
colors: {
|
|
19
|
+
primary: { main: "#7F9A65", dim: "#5F7E4A", bright: "#9CB482", pale: "#B8C9A9" },
|
|
20
|
+
success: { main: "#86efac", dim: "#4ade80" },
|
|
21
|
+
warning: { main: "#fde047", dim: "#fbbf24" },
|
|
22
|
+
error: { main: "#f87171", dim: "#dc2626" },
|
|
23
|
+
muted: { main: "#8a9a7a", dim: "#6a7a5a", dark: "#4a5a3a" },
|
|
24
|
+
background: { dark: "#1a1a1a", darker: "#0f0f0f" },
|
|
25
|
+
text: { primary: "#e2e8f0", secondary: "#94a3b8", disabled: "#64748b" },
|
|
26
|
+
},
|
|
27
|
+
ui: {
|
|
28
|
+
borderColor: "#7F9A65",
|
|
29
|
+
selectionColor: "#7F9A65",
|
|
30
|
+
highlightColor: "#9CB482",
|
|
31
|
+
promptColor: "#7F9A65",
|
|
32
|
+
pathColor: "#7F9A65",
|
|
33
|
+
},
|
|
34
|
+
syntax: {
|
|
35
|
+
keyword: "#9CB482",
|
|
36
|
+
string: "#86efac",
|
|
37
|
+
code: "#a8b896",
|
|
38
|
+
heading: "#9CB482",
|
|
39
|
+
link: "#7F9A65",
|
|
40
|
+
href: "#5F7E4A",
|
|
41
|
+
},
|
|
42
|
+
icons: { ...ICONS },
|
|
43
|
+
};
|
|
44
|
+
const THEME_LIGHT = {
|
|
45
|
+
name: "matcha-light",
|
|
46
|
+
description: "Matcha green theme for light terminals",
|
|
47
|
+
colors: {
|
|
48
|
+
primary: { main: "#5a7247", dim: "#4a6238", bright: "#6b8f52", pale: "#7a9a5a" },
|
|
49
|
+
success: { main: "#16a34a", dim: "#15803d" },
|
|
50
|
+
warning: { main: "#ca8a04", dim: "#a16207" },
|
|
51
|
+
error: { main: "#dc2626", dim: "#b91c1c" },
|
|
52
|
+
muted: { main: "#6b7a5a", dim: "#5a6a4a", dark: "#4a5a3a" },
|
|
53
|
+
background: { dark: "#f1f5f9", darker: "#e2e8f0" },
|
|
54
|
+
text: { primary: "#1e293b", secondary: "#475569", disabled: "#64748b" },
|
|
55
|
+
},
|
|
56
|
+
ui: {
|
|
57
|
+
borderColor: "#5a7247",
|
|
58
|
+
selectionColor: "#5a7247",
|
|
59
|
+
highlightColor: "#6b8f52",
|
|
60
|
+
promptColor: "#5a7247",
|
|
61
|
+
pathColor: "#5a7247",
|
|
62
|
+
},
|
|
63
|
+
syntax: {
|
|
64
|
+
keyword: "#4d7c2c",
|
|
65
|
+
string: "#15803d",
|
|
66
|
+
code: "#475569",
|
|
67
|
+
heading: "#4d7c2c",
|
|
68
|
+
link: "#5a7247",
|
|
69
|
+
href: "#4a6238",
|
|
70
|
+
},
|
|
71
|
+
icons: { ...ICONS },
|
|
72
|
+
};
|
|
73
|
+
function isDarkMode() {
|
|
74
|
+
const colorFgBg = process.env.COLORFGBG;
|
|
75
|
+
if (!colorFgBg)
|
|
76
|
+
return true;
|
|
77
|
+
const parts = colorFgBg.split(";");
|
|
78
|
+
const bg = parts[1]?.trim();
|
|
79
|
+
if (bg === "default" || !bg)
|
|
80
|
+
return true;
|
|
81
|
+
const n = parseInt(bg, 10);
|
|
82
|
+
if (Number.isNaN(n))
|
|
83
|
+
return true;
|
|
84
|
+
return n <= 7;
|
|
85
|
+
}
|
|
86
|
+
const theme = isDarkMode() ? THEME_DARK : THEME_LIGHT;
|
|
87
|
+
export { theme };
|
|
88
|
+
export const colors = {
|
|
89
|
+
accent: chalk.hex(theme.colors.primary.main),
|
|
90
|
+
accentBright: chalk.hex(theme.colors.primary.bright),
|
|
91
|
+
accentPale: chalk.hex(theme.colors.primary.pale),
|
|
92
|
+
accentDim: chalk.hex(theme.colors.primary.dim).dim,
|
|
93
|
+
success: chalk.hex(theme.colors.success.main),
|
|
94
|
+
warn: chalk.hex(theme.colors.warning.main),
|
|
95
|
+
error: chalk.hex(theme.colors.error.main),
|
|
96
|
+
muted: chalk.hex(theme.colors.muted.main),
|
|
97
|
+
tool: chalk.hex(theme.colors.muted.dim),
|
|
98
|
+
toolDim: chalk.hex(theme.colors.muted.dark).dim,
|
|
99
|
+
toolSuccess: chalk.hex("#6b8f71"),
|
|
100
|
+
toolFail: chalk.hex("#b85c5c"),
|
|
101
|
+
dim: chalk.hex(theme.colors.text.disabled).dim,
|
|
102
|
+
bold: chalk.bold,
|
|
103
|
+
italic: chalk.italic,
|
|
104
|
+
gray: chalk.hex(theme.colors.text.secondary),
|
|
105
|
+
mutedDark: chalk.hex(theme.colors.muted.dark),
|
|
106
|
+
};
|
|
107
|
+
export const inkColors = {
|
|
108
|
+
primary: theme.colors.primary.main,
|
|
109
|
+
primaryDim: theme.colors.primary.dim,
|
|
110
|
+
primaryBright: theme.colors.primary.bright,
|
|
111
|
+
primaryPale: theme.colors.primary.pale,
|
|
112
|
+
success: theme.colors.success.main,
|
|
113
|
+
successDim: theme.colors.success.dim,
|
|
114
|
+
warning: theme.colors.warning.main,
|
|
115
|
+
error: theme.colors.error.main,
|
|
116
|
+
errorDim: theme.colors.error.dim,
|
|
117
|
+
muted: theme.colors.muted.main,
|
|
118
|
+
mutedDim: theme.colors.muted.dim,
|
|
119
|
+
mutedDark: theme.colors.muted.dark,
|
|
120
|
+
border: theme.ui.borderColor,
|
|
121
|
+
selection: theme.ui.selectionColor,
|
|
122
|
+
highlight: theme.ui.highlightColor,
|
|
123
|
+
prompt: theme.ui.promptColor,
|
|
124
|
+
path: theme.ui.pathColor,
|
|
125
|
+
textPrimary: theme.colors.text.primary,
|
|
126
|
+
textSecondary: theme.colors.text.secondary,
|
|
127
|
+
textDisabled: theme.colors.text.disabled,
|
|
128
|
+
};
|
|
129
|
+
export const icons = theme.icons;
|
package/package.json
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "ideacode",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "CLI TUI for AI agents via OpenRouter — agentic loop, tools, markdown",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "dist/index.js",
|
|
7
|
+
"bin": { "ideacode": "dist/index.js" },
|
|
8
|
+
"files": ["dist", "README.md"],
|
|
9
|
+
"scripts": {
|
|
10
|
+
"build": "tsc",
|
|
11
|
+
"start": "node dist/index.js",
|
|
12
|
+
"dev": "tsc && node dist/index.js",
|
|
13
|
+
"run": "tsx src/index.tsx",
|
|
14
|
+
"format": "prettier --write \"src/**/*.{ts,tsx,json}\"",
|
|
15
|
+
"fmt": "npm run format",
|
|
16
|
+
"test:web-search": "tsx src/tools/web-search.test.ts",
|
|
17
|
+
"postinstall": "npx playwright install chromium"
|
|
18
|
+
},
|
|
19
|
+
"dependencies": {
|
|
20
|
+
"boxen": "^8.0.1",
|
|
21
|
+
"chalk": "^5.6.2",
|
|
22
|
+
"cli-highlight": "^2.1.11",
|
|
23
|
+
"dotenv": "^17.2.3",
|
|
24
|
+
"glob": "^11.0.0",
|
|
25
|
+
"gradient-string": "^3.0.0",
|
|
26
|
+
"ink": "^5.1.0",
|
|
27
|
+
"marked": "^15.0.12",
|
|
28
|
+
"marked-terminal": "^7.3.0",
|
|
29
|
+
"ora": "^9.1.0",
|
|
30
|
+
"playwright": "^1.49.0",
|
|
31
|
+
"react": "^18.3.1"
|
|
32
|
+
},
|
|
33
|
+
"devDependencies": {
|
|
34
|
+
"@types/node": "^22.10.0",
|
|
35
|
+
"@types/react": "^18.3.12",
|
|
36
|
+
"prettier": "^3.4.2",
|
|
37
|
+
"tsx": "^4.19.2",
|
|
38
|
+
"typescript": "^5.7.2"
|
|
39
|
+
}
|
|
40
|
+
}
|