nomi-opencode 2.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.
- package/LICENSE +21 -0
- package/README.md +140 -0
- package/README.zh-CN.md +140 -0
- package/dist/cli/install.d.ts +3 -0
- package/dist/cli/install.d.ts.map +1 -0
- package/dist/cli/install.js +296 -0
- package/dist/cli/install.js.map +1 -0
- package/dist/src/index.d.ts +6 -0
- package/dist/src/index.d.ts.map +1 -0
- package/dist/src/index.js +9 -0
- package/dist/src/index.js.map +1 -0
- package/dist/src/memory/store.d.ts +31 -0
- package/dist/src/memory/store.d.ts.map +1 -0
- package/dist/src/memory/store.js +387 -0
- package/dist/src/memory/store.js.map +1 -0
- package/dist/src/memory/types.d.ts +42 -0
- package/dist/src/memory/types.d.ts.map +1 -0
- package/dist/src/memory/types.js +2 -0
- package/dist/src/memory/types.js.map +1 -0
- package/dist/src/plugins/nomi-memory.d.ts +3 -0
- package/dist/src/plugins/nomi-memory.d.ts.map +1 -0
- package/dist/src/plugins/nomi-memory.js +165 -0
- package/dist/src/plugins/nomi-memory.js.map +1 -0
- package/dist/src/tools/recall.d.ts +22 -0
- package/dist/src/tools/recall.d.ts.map +1 -0
- package/dist/src/tools/recall.js +33 -0
- package/dist/src/tools/recall.js.map +1 -0
- package/dist/src/tools/remember.d.ts +28 -0
- package/dist/src/tools/remember.d.ts.map +1 -0
- package/dist/src/tools/remember.js +38 -0
- package/dist/src/tools/remember.js.map +1 -0
- package/package.json +64 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Nomi Contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
# nomi-opencode
|
|
2
|
+
|
|
3
|
+
**[English](./README.md) | [中文](./README.zh-CN.md)**
|
|
4
|
+
|
|
5
|
+
[](https://github.com/Zengxiaoer991214/nomi-agent/actions/workflows/ci.yml)
|
|
6
|
+
[](https://www.npmjs.com/package/nomi-opencode)
|
|
7
|
+
[](./LICENSE)
|
|
8
|
+
|
|
9
|
+
Long-term memory for [OpenCode](https://opencode.ai) — remember preferences, decisions, patterns and lessons across sessions.
|
|
10
|
+
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
## Installation
|
|
14
|
+
|
|
15
|
+
**Prerequisites**: Node.js ≥ 20 and [OpenCode](https://opencode.ai) installed.
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
npx nomi-opencode install
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
That's it. Restart OpenCode and Nomi starts injecting your memories into every session.
|
|
22
|
+
|
|
23
|
+
> Prefer a global install? `npm install -g nomi-opencode` then `nomi-opencode install`
|
|
24
|
+
|
|
25
|
+
---
|
|
26
|
+
|
|
27
|
+
## What it does
|
|
28
|
+
|
|
29
|
+
Nomi gives OpenCode AI a persistent memory store. The agent automatically:
|
|
30
|
+
|
|
31
|
+
- **Remembers** preferences, decisions, patterns, and lessons you tell it
|
|
32
|
+
- **Recalls** relevant context at the start of each session
|
|
33
|
+
- **Injects** up to ~1500 tokens of relevant memories into the system prompt
|
|
34
|
+
|
|
35
|
+
Memories are stored locally in a JSONL file at:
|
|
36
|
+
|
|
37
|
+
```
|
|
38
|
+
~/.config/opencode/nomi/memories.jsonl
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
Override the path with `NOMI_MEMORY_PATH=/your/path`.
|
|
42
|
+
|
|
43
|
+
---
|
|
44
|
+
|
|
45
|
+
## CLI reference
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
npx nomi-opencode install # Install into OpenCode global config
|
|
49
|
+
npx nomi-opencode update # Reinstall after upgrading the package
|
|
50
|
+
npx nomi-opencode uninstall # Remove all installed files
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
### What `install` does
|
|
54
|
+
|
|
55
|
+
1. Copies compiled runtime to `~/.config/opencode/nomi/`
|
|
56
|
+
2. Runs `npm install` inside that directory to resolve `@opencode-ai/plugin`
|
|
57
|
+
3. Writes generated plugin/tool files into your OpenCode config:
|
|
58
|
+
- `~/.config/opencode/plugins/nomi-memory.ts`
|
|
59
|
+
- `~/.config/opencode/tools/remember.ts`
|
|
60
|
+
- `~/.config/opencode/tools/recall.ts`
|
|
61
|
+
- `~/.config/opencode/agents/nomi.md`
|
|
62
|
+
|
|
63
|
+
---
|
|
64
|
+
|
|
65
|
+
## Memory categories
|
|
66
|
+
|
|
67
|
+
| Category | Use for |
|
|
68
|
+
| ------------ | -------------------------------------------- |
|
|
69
|
+
| `preference` | Communication style, code style preferences |
|
|
70
|
+
| `decision` | Technology choices and the reasoning behind |
|
|
71
|
+
| `pattern` | Project conventions, naming, code patterns |
|
|
72
|
+
| `lesson` | Bugs fixed, pitfalls to avoid next time |
|
|
73
|
+
| `context` | Project background, key dependencies, paths |
|
|
74
|
+
|
|
75
|
+
---
|
|
76
|
+
|
|
77
|
+
## Local Dashboard
|
|
78
|
+
|
|
79
|
+
Nomi includes a local web dashboard for browsing and managing your memories.
|
|
80
|
+
|
|
81
|
+
```bash
|
|
82
|
+
cd nomi-dashboard
|
|
83
|
+
npm install
|
|
84
|
+
npm run build # build frontend assets
|
|
85
|
+
npm run api # start Hono server at http://127.0.0.1:3210
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
Available at **http://127.0.0.1:3210**
|
|
89
|
+
|
|
90
|
+
The dashboard supports: list, search, filter by category/project, create, edit, delete, bulk delete, import, export, and stats.
|
|
91
|
+
|
|
92
|
+
---
|
|
93
|
+
|
|
94
|
+
## Configuration
|
|
95
|
+
|
|
96
|
+
| Environment variable | Default | Description |
|
|
97
|
+
| --------------------- | ---------------------------------------- | ----------------------------- |
|
|
98
|
+
| `NOMI_MEMORY_PATH` | `~/.config/opencode/nomi/memories.jsonl` | Where memories are stored |
|
|
99
|
+
| `OPENCODE_CONFIG_DIR` | `~/.config/opencode` | Override OpenCode config root |
|
|
100
|
+
|
|
101
|
+
---
|
|
102
|
+
|
|
103
|
+
## How injection works
|
|
104
|
+
|
|
105
|
+
At the start of each session the plugin selects memories up to a ~1500-token budget, in priority order:
|
|
106
|
+
|
|
107
|
+
1. Global `preference` memories
|
|
108
|
+
2. Memories tagged with the current project directory
|
|
109
|
+
3. High-hit-count global memories
|
|
110
|
+
|
|
111
|
+
---
|
|
112
|
+
|
|
113
|
+
## Contributing
|
|
114
|
+
|
|
115
|
+
```bash
|
|
116
|
+
git clone https://github.com/Zengxiaoer991214/nomi-agent.git
|
|
117
|
+
cd nomi-agent
|
|
118
|
+
npm install
|
|
119
|
+
npm run check # typecheck
|
|
120
|
+
npm run build # compile to dist/
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
Project layout:
|
|
124
|
+
|
|
125
|
+
```
|
|
126
|
+
src/
|
|
127
|
+
memory/ # Core memory store (JSONL CRUD + search)
|
|
128
|
+
plugins/ # OpenCode plugin definition
|
|
129
|
+
tools/ # remember / recall tool definitions
|
|
130
|
+
cli/
|
|
131
|
+
install.ts # npx installer
|
|
132
|
+
nomi-dashboard/ # Local React dashboard (private, not published)
|
|
133
|
+
.opencode/ # Project-local OpenCode config (for development)
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
---
|
|
137
|
+
|
|
138
|
+
## License
|
|
139
|
+
|
|
140
|
+
MIT © Nomi Contributors
|
package/README.zh-CN.md
ADDED
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
# nomi-opencode
|
|
2
|
+
|
|
3
|
+
**[English](./README.md) | [中文](./README.zh-CN.md)**
|
|
4
|
+
|
|
5
|
+
[](https://github.com/Zengxiaoer991214/nomi-agent/actions/workflows/ci.yml)
|
|
6
|
+
[](https://www.npmjs.com/package/nomi-opencode)
|
|
7
|
+
[](./LICENSE)
|
|
8
|
+
|
|
9
|
+
为 [OpenCode](https://opencode.ai) 提供长期记忆——跨会话记住你的偏好、决策、模式和经验教训。
|
|
10
|
+
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
## 安装
|
|
14
|
+
|
|
15
|
+
**前置条件**:Node.js ≥ 20,且已安装 [OpenCode](https://opencode.ai)。
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
npx nomi-opencode install
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
就这一条命令。重启 OpenCode,Nomi 就会在每次会话开始时自动注入你的记忆。
|
|
22
|
+
|
|
23
|
+
> 喜欢全局安装?`npm install -g nomi-opencode` 然后执行 `nomi-opencode install`
|
|
24
|
+
|
|
25
|
+
---
|
|
26
|
+
|
|
27
|
+
## 功能介绍
|
|
28
|
+
|
|
29
|
+
Nomi 为 OpenCode AI 提供持久化的记忆存储,Agent 会自动:
|
|
30
|
+
|
|
31
|
+
- **记录** 你告诉它的偏好、决策、模式和经验
|
|
32
|
+
- **回忆** 每次会话开始时的相关上下文
|
|
33
|
+
- **注入** 最多约 1500 token 的相关记忆到系统提示中
|
|
34
|
+
|
|
35
|
+
记忆默认以 JSONL 文件存储在本地:
|
|
36
|
+
|
|
37
|
+
```
|
|
38
|
+
~/.config/opencode/nomi/memories.jsonl
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
可通过 `NOMI_MEMORY_PATH=/your/path` 覆盖路径。
|
|
42
|
+
|
|
43
|
+
---
|
|
44
|
+
|
|
45
|
+
## CLI 命令
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
npx nomi-opencode install # 安装到 OpenCode 全局配置
|
|
49
|
+
npx nomi-opencode update # 升级包后重新安装
|
|
50
|
+
npx nomi-opencode uninstall # 移除所有已安装文件
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
### `install` 做了什么
|
|
54
|
+
|
|
55
|
+
1. 将编译后的运行时复制到 `~/.config/opencode/nomi/`
|
|
56
|
+
2. 在该目录内运行 `npm install` 以解析 `@opencode-ai/plugin`
|
|
57
|
+
3. 在你的 OpenCode 配置中写入生成的插件/工具文件:
|
|
58
|
+
- `~/.config/opencode/plugins/nomi-memory.ts`
|
|
59
|
+
- `~/.config/opencode/tools/remember.ts`
|
|
60
|
+
- `~/.config/opencode/tools/recall.ts`
|
|
61
|
+
- `~/.config/opencode/agents/nomi.md`
|
|
62
|
+
|
|
63
|
+
---
|
|
64
|
+
|
|
65
|
+
## 记忆分类
|
|
66
|
+
|
|
67
|
+
| 分类 | 适用场景 |
|
|
68
|
+
| ------------ | -------------------------------- |
|
|
69
|
+
| `preference` | 沟通风格、代码风格偏好 |
|
|
70
|
+
| `decision` | 技术选型及背后的原因 |
|
|
71
|
+
| `pattern` | 项目约定、命名规范、代码模式 |
|
|
72
|
+
| `lesson` | 修复的 Bug、下次要避免的坑 |
|
|
73
|
+
| `context` | 项目背景、关键依赖、重要路径 |
|
|
74
|
+
|
|
75
|
+
---
|
|
76
|
+
|
|
77
|
+
## 本地 Dashboard
|
|
78
|
+
|
|
79
|
+
Nomi 内置一个本地 Web Dashboard,用于浏览和管理你的记忆。
|
|
80
|
+
|
|
81
|
+
```bash
|
|
82
|
+
cd nomi-dashboard
|
|
83
|
+
npm install
|
|
84
|
+
npm run build # 构建前端资源
|
|
85
|
+
npm run api # 启动 Hono 服务器,访问 http://127.0.0.1:3210
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
访问 **http://127.0.0.1:3210**
|
|
89
|
+
|
|
90
|
+
Dashboard 支持:列表、搜索、按分类/项目筛选、创建、编辑、删除、批量删除、导入、导出和统计。
|
|
91
|
+
|
|
92
|
+
---
|
|
93
|
+
|
|
94
|
+
## 配置项
|
|
95
|
+
|
|
96
|
+
| 环境变量 | 默认值 | 说明 |
|
|
97
|
+
| --------------------- | ---------------------------------------- | ------------------------ |
|
|
98
|
+
| `NOMI_MEMORY_PATH` | `~/.config/opencode/nomi/memories.jsonl` | 记忆文件存储路径 |
|
|
99
|
+
| `OPENCODE_CONFIG_DIR` | `~/.config/opencode` | 覆盖 OpenCode 配置根目录 |
|
|
100
|
+
|
|
101
|
+
---
|
|
102
|
+
|
|
103
|
+
## 注入原理
|
|
104
|
+
|
|
105
|
+
每次会话开始时,插件按以下优先级选取记忆,直到填满约 1500 token 的预算:
|
|
106
|
+
|
|
107
|
+
1. 全局 `preference` 类记忆
|
|
108
|
+
2. 带有当前项目目录标签的记忆
|
|
109
|
+
3. 命中次数较高的全局记忆
|
|
110
|
+
|
|
111
|
+
---
|
|
112
|
+
|
|
113
|
+
## 参与贡献
|
|
114
|
+
|
|
115
|
+
```bash
|
|
116
|
+
git clone https://github.com/Zengxiaoer991214/nomi-agent.git
|
|
117
|
+
cd nomi-agent
|
|
118
|
+
npm install
|
|
119
|
+
npm run check # 类型检查
|
|
120
|
+
npm run build # 编译到 dist/
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
项目结构:
|
|
124
|
+
|
|
125
|
+
```
|
|
126
|
+
src/
|
|
127
|
+
memory/ # 核心记忆存储(JSONL 增删改查+搜索)
|
|
128
|
+
plugins/ # OpenCode 插件定义
|
|
129
|
+
tools/ # remember / recall 工具定义
|
|
130
|
+
cli/
|
|
131
|
+
install.ts # npx 安装器
|
|
132
|
+
nomi-dashboard/ # 本地 React Dashboard(私有,不发布到 npm)
|
|
133
|
+
.opencode/ # 项目本地 OpenCode 配置(开发用)
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
---
|
|
137
|
+
|
|
138
|
+
## 许可证
|
|
139
|
+
|
|
140
|
+
MIT © Nomi Contributors
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"install.d.ts","sourceRoot":"","sources":["../../cli/install.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,296 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { cpSync, existsSync, mkdirSync, readFileSync, rmSync, writeFileSync } from 'node:fs';
|
|
3
|
+
import { execSync } from 'node:child_process';
|
|
4
|
+
import { homedir, platform } from 'node:os';
|
|
5
|
+
import { dirname, join } from 'node:path';
|
|
6
|
+
import { fileURLToPath } from 'node:url';
|
|
7
|
+
// ─── ANSI colours ────────────────────────────────────────────────────────────
|
|
8
|
+
const RESET = '\x1b[0m';
|
|
9
|
+
const BOLD = '\x1b[1m';
|
|
10
|
+
const GREEN = '\x1b[32m';
|
|
11
|
+
const RED = '\x1b[31m';
|
|
12
|
+
const YELLOW = '\x1b[33m';
|
|
13
|
+
const CYAN = '\x1b[36m';
|
|
14
|
+
const DIM = '\x1b[2m';
|
|
15
|
+
const info = (msg) => console.log(`${CYAN}[nomi]${RESET} ${msg}`);
|
|
16
|
+
const success = (msg) => console.log(`${GREEN}${BOLD}✓${RESET} ${msg}`);
|
|
17
|
+
const warn = (msg) => console.log(`${YELLOW}⚠${RESET} ${msg}`);
|
|
18
|
+
const err = (msg) => console.error(`${RED}${BOLD}✗${RESET} ${msg}`);
|
|
19
|
+
const dim = (msg) => console.log(` ${DIM}${msg}${RESET}`);
|
|
20
|
+
// ─── Path helpers ─────────────────────────────────────────────────────────────
|
|
21
|
+
/**
|
|
22
|
+
* Convert any Windows backslash path to forward slashes.
|
|
23
|
+
* TypeScript import specifiers always use forward slashes.
|
|
24
|
+
*/
|
|
25
|
+
function toImportPath(p) {
|
|
26
|
+
return p.replace(/\\/g, '/');
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Resolve the OpenCode global config directory.
|
|
30
|
+
* OpenCode uses ~/.config/opencode/ on all platforms.
|
|
31
|
+
* Override via OPENCODE_CONFIG_DIR env var.
|
|
32
|
+
*/
|
|
33
|
+
function getOpenCodeConfigDir() {
|
|
34
|
+
return process.env.OPENCODE_CONFIG_DIR ?? join(homedir(), '.config', 'opencode');
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* The dist/ directory that the CLI lives inside.
|
|
38
|
+
* CLI is compiled to dist/cli/install.js → dist/ is one level up.
|
|
39
|
+
*/
|
|
40
|
+
function getDistDir() {
|
|
41
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
42
|
+
return join(dirname(__filename), '..');
|
|
43
|
+
}
|
|
44
|
+
// ─── Agent content (embedded so we need no extra asset files) ─────────────────
|
|
45
|
+
const NOMI_AGENT_CONTENT = `# Nomi
|
|
46
|
+
|
|
47
|
+
Nomi 是带长期记忆的通用开发助手。
|
|
48
|
+
|
|
49
|
+
## 核心行为
|
|
50
|
+
|
|
51
|
+
- 简单任务直接执行
|
|
52
|
+
- 用户只是打招呼、寒暄、确认你是否在线时,直接自然回复,不调用工具,不读取文件,不检索记忆
|
|
53
|
+
- 复杂任务先拆解再执行
|
|
54
|
+
- 遇到长期有效的用户偏好、技术决策、项目模式、踩坑结论时,主动调用 \`remember\`
|
|
55
|
+
- 在进入陌生项目、恢复上下文、或需要历史决策时,主动调用 \`recall\`
|
|
56
|
+
|
|
57
|
+
## 人格
|
|
58
|
+
|
|
59
|
+
- Nomi 仅为助手名称,回复保持专业、直接,不做拟猫化表达(如"喵")
|
|
60
|
+
- 直接、克制、务实
|
|
61
|
+
|
|
62
|
+
## 长期记忆约定
|
|
63
|
+
|
|
64
|
+
- \`preference\`:用户明确偏好与沟通方式
|
|
65
|
+
- \`decision\`:技术方案和选型原因
|
|
66
|
+
- \`pattern\`:项目约定、命名规范、代码模式
|
|
67
|
+
- \`lesson\`:踩坑、修复路径、避免再次犯错的方法
|
|
68
|
+
- \`context\`:项目背景、关键依赖、核心路径
|
|
69
|
+
|
|
70
|
+
仅在信息具有跨 session 价值时写入长期记忆。
|
|
71
|
+
`;
|
|
72
|
+
// ─── Template generators ──────────────────────────────────────────────────────
|
|
73
|
+
const GENERATED_TS_HEADER = '// Generated by nomi-opencode installer. Do not edit manually.\n// To update: npx nomi-opencode update\n';
|
|
74
|
+
const GENERATED_MD_HEADER = '<!-- Generated by nomi-opencode installer. Do not edit manually. -->\n<!-- To update: npx nomi-opencode update -->\n\n';
|
|
75
|
+
function generatePluginFile(nomiDir) {
|
|
76
|
+
const importPath = toImportPath(join(nomiDir, 'src', 'plugins', 'nomi-memory.js'));
|
|
77
|
+
return `${GENERATED_TS_HEADER}export { NomiMemoryPlugin as default } from '${importPath}'\n`;
|
|
78
|
+
}
|
|
79
|
+
function generateToolFile(nomiDir, toolName) {
|
|
80
|
+
const importPath = toImportPath(join(nomiDir, 'src', 'tools', `${toolName}.js`));
|
|
81
|
+
return `${GENERATED_TS_HEADER}export { ${toolName} } from '${importPath}'\n`;
|
|
82
|
+
}
|
|
83
|
+
function generateAgentFile() {
|
|
84
|
+
return `${GENERATED_MD_HEADER}${NOMI_AGENT_CONTENT}`;
|
|
85
|
+
}
|
|
86
|
+
function generateRuntimePackageJson() {
|
|
87
|
+
return JSON.stringify({
|
|
88
|
+
name: 'nomi-opencode-runtime',
|
|
89
|
+
type: 'module',
|
|
90
|
+
private: true,
|
|
91
|
+
dependencies: {
|
|
92
|
+
'@opencode-ai/plugin': '>=1.14.0',
|
|
93
|
+
},
|
|
94
|
+
}, null, 2) + '\n';
|
|
95
|
+
}
|
|
96
|
+
// ─── Check if a file was generated by this installer ─────────────────────────
|
|
97
|
+
function isGeneratedByNomi(filePath) {
|
|
98
|
+
if (!existsSync(filePath)) {
|
|
99
|
+
return false;
|
|
100
|
+
}
|
|
101
|
+
try {
|
|
102
|
+
const content = readFileSync(filePath, 'utf8');
|
|
103
|
+
return (content.startsWith(GENERATED_TS_HEADER)
|
|
104
|
+
|| content.startsWith(GENERATED_MD_HEADER)
|
|
105
|
+
|| content.startsWith('// Generated by nomi-opencode')
|
|
106
|
+
|| content.startsWith('<!-- Generated by nomi-opencode'));
|
|
107
|
+
}
|
|
108
|
+
catch {
|
|
109
|
+
return false;
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
// ─── npm runner (cross-platform) ─────────────────────────────────────────────
|
|
113
|
+
function runNpmInstall(cwd) {
|
|
114
|
+
// Use the platform shell so `npm` is always found via PATH.
|
|
115
|
+
// On Windows cmd.exe resolves npm.cmd; on Unix /bin/sh resolves npm.
|
|
116
|
+
const shell = platform() === 'win32' ? 'cmd.exe' : '/bin/sh';
|
|
117
|
+
execSync('npm install --prefer-offline --no-audit --no-fund', {
|
|
118
|
+
cwd,
|
|
119
|
+
stdio: 'pipe',
|
|
120
|
+
shell,
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
// ─── Commands ─────────────────────────────────────────────────────────────────
|
|
124
|
+
function install() {
|
|
125
|
+
const configDir = getOpenCodeConfigDir();
|
|
126
|
+
const nomiDir = join(configDir, 'nomi');
|
|
127
|
+
const pluginsDir = join(configDir, 'plugins');
|
|
128
|
+
const toolsDir = join(configDir, 'tools');
|
|
129
|
+
const agentsDir = join(configDir, 'agents');
|
|
130
|
+
const distDir = getDistDir();
|
|
131
|
+
console.log();
|
|
132
|
+
info(`Installing nomi-opencode to ${configDir}`);
|
|
133
|
+
console.log();
|
|
134
|
+
// ── 1. Create directories ──────────────────────────────────────────────────
|
|
135
|
+
for (const dir of [nomiDir, pluginsDir, toolsDir, agentsDir]) {
|
|
136
|
+
mkdirSync(dir, { recursive: true });
|
|
137
|
+
}
|
|
138
|
+
// ── 2. Copy dist/ → ~/.config/opencode/nomi/ ──────────────────────────────
|
|
139
|
+
info('Copying runtime files...');
|
|
140
|
+
cpSync(distDir, nomiDir, {
|
|
141
|
+
recursive: true,
|
|
142
|
+
force: true,
|
|
143
|
+
filter: (src) => {
|
|
144
|
+
// Skip the CLI directory itself (not needed at runtime)
|
|
145
|
+
const relative = src.slice(distDir.length).replace(/\\/g, '/');
|
|
146
|
+
return !relative.startsWith('/cli');
|
|
147
|
+
},
|
|
148
|
+
});
|
|
149
|
+
success('Runtime files copied');
|
|
150
|
+
// ── 3. Write package.json + npm install @opencode-ai/plugin ───────────────
|
|
151
|
+
info('Installing @opencode-ai/plugin dependency...');
|
|
152
|
+
writeFileSync(join(nomiDir, 'package.json'), generateRuntimePackageJson(), 'utf8');
|
|
153
|
+
try {
|
|
154
|
+
runNpmInstall(nomiDir);
|
|
155
|
+
success('@opencode-ai/plugin installed');
|
|
156
|
+
}
|
|
157
|
+
catch (error) {
|
|
158
|
+
warn('npm install failed — you may need to run it manually:');
|
|
159
|
+
dim(`cd "${nomiDir}" && npm install`);
|
|
160
|
+
dim('Error: ' + String(error));
|
|
161
|
+
}
|
|
162
|
+
// ── 4. Generate plugin/tool wrapper files ─────────────────────────────────
|
|
163
|
+
info('Generating OpenCode plugin and tool files...');
|
|
164
|
+
const pluginFile = join(pluginsDir, 'nomi-memory.ts');
|
|
165
|
+
const rememberFile = join(toolsDir, 'remember.ts');
|
|
166
|
+
const recallFile = join(toolsDir, 'recall.ts');
|
|
167
|
+
const agentFile = join(agentsDir, 'nomi.md');
|
|
168
|
+
// Warn if files already exist and weren't generated by us
|
|
169
|
+
for (const [label, path] of [['plugin', pluginFile], ['tool remember', rememberFile], ['tool recall', recallFile]]) {
|
|
170
|
+
if (existsSync(path) && !isGeneratedByNomi(path)) {
|
|
171
|
+
warn(`Existing ${label} file at ${path} — overwriting`);
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
writeFileSync(pluginFile, generatePluginFile(nomiDir), 'utf8');
|
|
175
|
+
writeFileSync(rememberFile, generateToolFile(nomiDir, 'remember'), 'utf8');
|
|
176
|
+
writeFileSync(recallFile, generateToolFile(nomiDir, 'recall'), 'utf8');
|
|
177
|
+
// Only write agent file if it doesn't already exist
|
|
178
|
+
if (existsSync(agentFile)) {
|
|
179
|
+
warn('Agent file already exists — skipping (remove manually to reset)');
|
|
180
|
+
dim(agentFile);
|
|
181
|
+
}
|
|
182
|
+
else {
|
|
183
|
+
writeFileSync(agentFile, generateAgentFile(), 'utf8');
|
|
184
|
+
success('Agent file created');
|
|
185
|
+
}
|
|
186
|
+
success('Plugin and tool files generated');
|
|
187
|
+
// ── 5. Summary ────────────────────────────────────────────────────────────
|
|
188
|
+
console.log();
|
|
189
|
+
console.log(`${GREEN}${BOLD}Nomi is installed!${RESET}`);
|
|
190
|
+
console.log();
|
|
191
|
+
console.log('Files written:');
|
|
192
|
+
dim(`${pluginFile}`);
|
|
193
|
+
dim(`${rememberFile}`);
|
|
194
|
+
dim(`${recallFile}`);
|
|
195
|
+
dim(`${agentFile}`);
|
|
196
|
+
console.log();
|
|
197
|
+
console.log('Memories are stored at:');
|
|
198
|
+
dim(join(homedir(), '.config', 'opencode', 'nomi', 'memories.jsonl'));
|
|
199
|
+
console.log(' Override with env: NOMI_MEMORY_PATH=/your/path/memories.jsonl');
|
|
200
|
+
console.log();
|
|
201
|
+
}
|
|
202
|
+
function uninstall() {
|
|
203
|
+
const configDir = getOpenCodeConfigDir();
|
|
204
|
+
const nomiDir = join(configDir, 'nomi');
|
|
205
|
+
const pluginsDir = join(configDir, 'plugins');
|
|
206
|
+
const toolsDir = join(configDir, 'tools');
|
|
207
|
+
const agentsDir = join(configDir, 'agents');
|
|
208
|
+
console.log();
|
|
209
|
+
info('Uninstalling nomi-opencode...');
|
|
210
|
+
console.log();
|
|
211
|
+
let removed = 0;
|
|
212
|
+
// Remove generated plugin/tool/agent files
|
|
213
|
+
for (const [label, path] of [
|
|
214
|
+
['plugin', join(pluginsDir, 'nomi-memory.ts')],
|
|
215
|
+
['tool remember', join(toolsDir, 'remember.ts')],
|
|
216
|
+
['tool recall', join(toolsDir, 'recall.ts')],
|
|
217
|
+
['agent', join(agentsDir, 'nomi.md')],
|
|
218
|
+
]) {
|
|
219
|
+
if (!existsSync(path)) {
|
|
220
|
+
dim(`${label}: not found, skipping`);
|
|
221
|
+
continue;
|
|
222
|
+
}
|
|
223
|
+
if (!isGeneratedByNomi(path)) {
|
|
224
|
+
warn(`${label} at ${path} was not generated by nomi-opencode — skipping`);
|
|
225
|
+
continue;
|
|
226
|
+
}
|
|
227
|
+
rmSync(path);
|
|
228
|
+
success(`Removed ${label}: ${path}`);
|
|
229
|
+
removed++;
|
|
230
|
+
}
|
|
231
|
+
// Remove the nomi runtime directory
|
|
232
|
+
if (existsSync(nomiDir)) {
|
|
233
|
+
rmSync(nomiDir, { recursive: true, force: true });
|
|
234
|
+
success(`Removed runtime: ${nomiDir}`);
|
|
235
|
+
removed++;
|
|
236
|
+
}
|
|
237
|
+
else {
|
|
238
|
+
dim('Runtime directory not found, skipping');
|
|
239
|
+
}
|
|
240
|
+
console.log();
|
|
241
|
+
if (removed > 0) {
|
|
242
|
+
console.log(`${GREEN}${BOLD}Nomi uninstalled.${RESET}`);
|
|
243
|
+
console.log();
|
|
244
|
+
console.log('Your memories file was NOT deleted. To remove it:');
|
|
245
|
+
dim(join(homedir(), '.config', 'opencode', 'nomi', 'memories.jsonl'));
|
|
246
|
+
}
|
|
247
|
+
else {
|
|
248
|
+
console.log(`${YELLOW}Nothing to uninstall — nomi was not installed.${RESET}`);
|
|
249
|
+
}
|
|
250
|
+
console.log();
|
|
251
|
+
}
|
|
252
|
+
function update() {
|
|
253
|
+
console.log();
|
|
254
|
+
info('Updating nomi-opencode...');
|
|
255
|
+
console.log();
|
|
256
|
+
uninstall();
|
|
257
|
+
install();
|
|
258
|
+
}
|
|
259
|
+
function printHelp() {
|
|
260
|
+
console.log();
|
|
261
|
+
console.log(`${BOLD}nomi-opencode${RESET} — long-term memory for OpenCode`);
|
|
262
|
+
console.log();
|
|
263
|
+
console.log('Usage:');
|
|
264
|
+
console.log(' npx nomi-opencode install Install globally into OpenCode config');
|
|
265
|
+
console.log(' npx nomi-opencode uninstall Remove installed files');
|
|
266
|
+
console.log(' npx nomi-opencode update Re-install (same as uninstall + install)');
|
|
267
|
+
console.log();
|
|
268
|
+
console.log('Environment:');
|
|
269
|
+
console.log(' OPENCODE_CONFIG_DIR Override OpenCode config directory');
|
|
270
|
+
console.log(' NOMI_MEMORY_PATH Override memories.jsonl location');
|
|
271
|
+
console.log();
|
|
272
|
+
}
|
|
273
|
+
// ─── Entry point ─────────────────────────────────────────────────────────────
|
|
274
|
+
const command = process.argv[2];
|
|
275
|
+
switch (command) {
|
|
276
|
+
case 'install':
|
|
277
|
+
install();
|
|
278
|
+
break;
|
|
279
|
+
case 'uninstall':
|
|
280
|
+
uninstall();
|
|
281
|
+
break;
|
|
282
|
+
case 'update':
|
|
283
|
+
update();
|
|
284
|
+
break;
|
|
285
|
+
case '--help':
|
|
286
|
+
case '-h':
|
|
287
|
+
case 'help':
|
|
288
|
+
case undefined:
|
|
289
|
+
printHelp();
|
|
290
|
+
break;
|
|
291
|
+
default:
|
|
292
|
+
err(`Unknown command: ${command}`);
|
|
293
|
+
printHelp();
|
|
294
|
+
process.exit(1);
|
|
295
|
+
}
|
|
296
|
+
//# sourceMappingURL=install.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"install.js","sourceRoot":"","sources":["../../cli/install.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,EAAE,aAAa,EAA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AC,GAAG,EAAE,CAAA;AACf,CAAC;AAED,gFAAgF;AAEhF,MAAM,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;AAE/B,QAAQ,OAAO,EAAE,CAAC;IAChB,KAAK,SAAS;QACZ,OAAO,EAAE,CAAA;QACT,MAAK;IACP,KAAK,WAAW;QACd,SAAS,EAAE,CAAA;QACX,MAAK;IACP,KAAK,QAAQ;QACX,MAAM,EAAE,CAAA;QACR,MAAK;IACP,KAAK,QAAQ,CAAC;IACd,KAAK,IAAI,CAAC;IACV,KAAK,MAAM,CAAC;IACZ,KAAK,SAAS;QACZ,SAAS,EAAE,CAAA;QACX,MAAK;IACP;QACE,GAAG,CAAC,oBAAoB,OAAO,EAAE,CAAC,CAAA;QAClC,SAAS,EAAE,CAAA;QACX,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;AACnB,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export type { Memory, MemoryCategory, MemorySource, RememberMemoryInput, RecallMemoryInput, MemoryListInput, MemoryUpsertInput, MemoryStats, } from './memory/types.js';
|
|
2
|
+
export { loadAllMemories, rememberMemory, recallMemories, listMemories, getMemoryById, updateMemory, deleteMemory, deleteMemories, importMemories, exportMemories, getMemoryStats, selectMemoriesForInjection, formatMemoriesForInjection, resolveMemoryFile, projectFromDirectory, } from './memory/store.js';
|
|
3
|
+
export { NomiMemoryPlugin } from './plugins/nomi-memory.js';
|
|
4
|
+
export { remember } from './tools/remember.js';
|
|
5
|
+
export { recall } from './tools/recall.js';
|
|
6
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAGA,YAAY,EACV,MAAM,EACN,cAAc,EACd,YAAY,EACZ,mBAAmB,EACnB,iBAAiB,EACjB,eAAe,EACf,iBAAiB,EACjB,WAAW,GACZ,MAAM,mBAAmB,CAAA;AAG1B,OAAO,EACL,eAAe,EACf,cAAc,EACd,cAAc,EACd,YAAY,EACZ,aAAa,EACb,YAAY,EACZ,YAAY,EACZ,cAAc,EACd,cAAc,EACd,cAAc,EACd,cAAc,EACd,0BAA0B,EAC1B,0BAA0B,EAC1B,iBAAiB,EACjB,oBAAoB,GACrB,MAAM,mBAAmB,CAAA;AAG1B,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAA;AAG3D,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAA;AAC9C,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAA"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
// Public API for nomi-opencode npm package
|
|
2
|
+
// Memory store operations
|
|
3
|
+
export { loadAllMemories, rememberMemory, recallMemories, listMemories, getMemoryById, updateMemory, deleteMemory, deleteMemories, importMemories, exportMemories, getMemoryStats, selectMemoriesForInjection, formatMemoriesForInjection, resolveMemoryFile, projectFromDirectory, } from './memory/store.js';
|
|
4
|
+
// OpenCode plugin
|
|
5
|
+
export { NomiMemoryPlugin } from './plugins/nomi-memory.js';
|
|
6
|
+
// OpenCode tools
|
|
7
|
+
export { remember } from './tools/remember.js';
|
|
8
|
+
export { recall } from './tools/recall.js';
|
|
9
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,2CAA2C;AAc3C,0BAA0B;AAC1B,OAAO,EACL,eAAe,EACf,cAAc,EACd,cAAc,EACd,YAAY,EACZ,aAAa,EACb,YAAY,EACZ,YAAY,EACZ,cAAc,EACd,cAAc,EACd,cAAc,EACd,cAAc,EACd,0BAA0B,EAC1B,0BAA0B,EAC1B,iBAAiB,EACjB,oBAAoB,GACrB,MAAM,mBAAmB,CAAA;AAE1B,kBAAkB;AAClB,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAA;AAE3D,iBAAiB;AACjB,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAA;AAC9C,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAA"}
|