@mathew-cf/opencode-memory 0.2.0 → 0.2.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/README.md +20 -5
- package/dist/cli.d.ts +78 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +13180 -0
- package/dist/config.d.ts +7 -1
- package/dist/config.d.ts.map +1 -1
- package/dist/index.js +27 -6
- package/package.json +6 -3
- package/skills/opencode-memory/SKILL.md +11 -4
package/README.md
CHANGED
|
@@ -23,10 +23,18 @@ LLM agents forget everything between sessions. That means rediscovering the same
|
|
|
23
23
|
```jsonc
|
|
24
24
|
// opencode.jsonc
|
|
25
25
|
{
|
|
26
|
-
"plugin": ["@mathew-cf/opencode-memory@0.2.
|
|
26
|
+
"plugin": ["@mathew-cf/opencode-memory@0.2.1"]
|
|
27
27
|
}
|
|
28
28
|
```
|
|
29
29
|
|
|
30
|
+
Then bootstrap the memory directory + embedding model:
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
bunx @mathew-cf/opencode-memory init
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
This creates `~/opencode-memory/` (git repo, 7 category subdirs) and downloads the ~90MB embedding model. Idempotent — safe to re-run. Pass `--skip-model` to defer the download.
|
|
37
|
+
|
|
30
38
|
The plugin auto-registers:
|
|
31
39
|
|
|
32
40
|
- its bundled skill under `config.skills.paths`
|
|
@@ -56,12 +64,19 @@ If either dependency fails to install (unusual — usually indicates an unsuppor
|
|
|
56
64
|
|
|
57
65
|
### First-time setup
|
|
58
66
|
|
|
67
|
+
```bash
|
|
68
|
+
bunx @mathew-cf/opencode-memory init
|
|
59
69
|
```
|
|
60
|
-
mkdir -p ~/opencode-memory
|
|
61
|
-
cd ~/opencode-memory && git init
|
|
62
|
-
```
|
|
63
70
|
|
|
64
|
-
|
|
71
|
+
Creates `~/opencode-memory/` (or `$MEMORY_DIR`), runs `git init`, scaffolds the 7 advisory category subdirs (`preferences/`, `repos/`, `technical/`, `people/`, `workflows/`, `snippets/`, `notes/`), and pre-caches the embedding model for semantic search.
|
|
72
|
+
|
|
73
|
+
Subcommands:
|
|
74
|
+
|
|
75
|
+
| Command | Purpose |
|
|
76
|
+
| ----------------------------------------------- | ------------------------------------------------------ |
|
|
77
|
+
| `bunx @mathew-cf/opencode-memory init` | Create + git-init memory dir, download embedding model |
|
|
78
|
+
| `bunx @mathew-cf/opencode-memory init --skip-model` | Same, but skip the ~90MB download |
|
|
79
|
+
| `bunx @mathew-cf/opencode-memory status` | Report which search backends are resolvable |
|
|
65
80
|
|
|
66
81
|
### Writing memory
|
|
67
82
|
|
package/dist/cli.d.ts
ADDED
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
#!/usr/bin/env bun
|
|
2
|
+
/**
|
|
3
|
+
* opencode-memory CLI entry point.
|
|
4
|
+
*
|
|
5
|
+
* Runs under Bun (matching the runtime opencode itself uses). Required
|
|
6
|
+
* because the shared lib/* helpers use `Bun.$` for shell calls and
|
|
7
|
+
* `Bun.spawn`/`Bun.file` for filesystem work; rather than maintaining
|
|
8
|
+
* two implementations we standardize on bun. `bunx` always uses the
|
|
9
|
+
* bun runtime regardless of shebang, so the canonical
|
|
10
|
+
* `bunx @mathew-cf/opencode-memory init`
|
|
11
|
+
* just works. Direct invocations (`opencode-memory init` after
|
|
12
|
+
* `npm install -g`) require bun to be on PATH.
|
|
13
|
+
*
|
|
14
|
+
* Distributed via the `bin` field in package.json so users can run
|
|
15
|
+
* `bunx @mathew-cf/opencode-memory init`
|
|
16
|
+
* from a fresh machine to fully bootstrap the memory system: mkdir,
|
|
17
|
+
* git init, create category subdirs, pre-cache the embedding model,
|
|
18
|
+
* and report status.
|
|
19
|
+
*
|
|
20
|
+
* Subcommands (lazy-resolved so tests can call them with plain args
|
|
21
|
+
* without spawning a subprocess):
|
|
22
|
+
*
|
|
23
|
+
* init [--skip-model] [--quiet]
|
|
24
|
+
* Initialize the memory directory and download the embedding model.
|
|
25
|
+
* Idempotent — safe to run multiple times.
|
|
26
|
+
*
|
|
27
|
+
* status
|
|
28
|
+
* Report which search backends (ripgrep, rag-cli) are resolvable.
|
|
29
|
+
* Same output as the `memory_setup` tool.
|
|
30
|
+
*
|
|
31
|
+
* help
|
|
32
|
+
* Print usage.
|
|
33
|
+
*
|
|
34
|
+
* The CLI is intentionally tiny: the heavy lifting (rag download, ripgrep
|
|
35
|
+
* resolution) lives in src/lib/ and is shared with the plugin tools so
|
|
36
|
+
* a single bug fix benefits both surfaces.
|
|
37
|
+
*/
|
|
38
|
+
interface InitOptions {
|
|
39
|
+
/** Skip the rag download step. Useful in CI or for offline first-runs. */
|
|
40
|
+
skipModel?: boolean;
|
|
41
|
+
/** Suppress success lines (errors still print). For embedding in scripts. */
|
|
42
|
+
quiet?: boolean;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Result of `init`. Returned (rather than just printed) so tests can
|
|
46
|
+
* assert exactly what happened on disk.
|
|
47
|
+
*/
|
|
48
|
+
export interface InitResult {
|
|
49
|
+
memoryDir: string;
|
|
50
|
+
/** True if `git init` actually ran (vs. the dir already being a repo). */
|
|
51
|
+
gitInitialized: boolean;
|
|
52
|
+
/** Categories that were created in this run. Skipped categories aren't listed. */
|
|
53
|
+
createdCategories: string[];
|
|
54
|
+
/** True if the rag download step ran. */
|
|
55
|
+
modelDownloadAttempted: boolean;
|
|
56
|
+
/** Whatever rag download printed, if it ran. */
|
|
57
|
+
modelDownloadOutput?: string;
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Pure-ish init: takes an explicit memoryDir so tests can target a temp
|
|
61
|
+
* path. The CLI wrapper passes `resolveMemoryDir()`.
|
|
62
|
+
*/
|
|
63
|
+
export declare function initMemory(memoryDir: string, options?: InitOptions, log?: (msg: string) => void): Promise<InitResult>;
|
|
64
|
+
/**
|
|
65
|
+
* Print usage to stdout. Exported so tests can compare against it.
|
|
66
|
+
*/
|
|
67
|
+
export declare function usage(): string;
|
|
68
|
+
/**
|
|
69
|
+
* Parse argv tail into a simple options bag. Exported for tests.
|
|
70
|
+
* Recognised flags:
|
|
71
|
+
* --skip-model | -s InitOptions.skipModel = true
|
|
72
|
+
* --quiet | -q InitOptions.quiet = true
|
|
73
|
+
*/
|
|
74
|
+
export declare function parseInitFlags(argv: string[]): InitOptions;
|
|
75
|
+
/** CLI dispatcher. Exported so tests can drive it without exec(). */
|
|
76
|
+
export declare function dispatch(argv: string[]): Promise<number>;
|
|
77
|
+
export {};
|
|
78
|
+
//# sourceMappingURL=cli.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AACA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AAUH,UAAU,WAAW;IACnB,0EAA0E;IAC1E,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,6EAA6E;IAC7E,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AAED;;;GAGG;AACH,MAAM,WAAW,UAAU;IACzB,SAAS,EAAE,MAAM,CAAC;IAClB,0EAA0E;IAC1E,cAAc,EAAE,OAAO,CAAC;IACxB,kFAAkF;IAClF,iBAAiB,EAAE,MAAM,EAAE,CAAC;IAC5B,yCAAyC;IACzC,sBAAsB,EAAE,OAAO,CAAC;IAChC,gDAAgD;IAChD,mBAAmB,CAAC,EAAE,MAAM,CAAC;CAC9B;AAED;;;GAGG;AACH,wBAAsB,UAAU,CAC9B,SAAS,EAAE,MAAM,EACjB,OAAO,GAAE,WAAgB,EACzB,GAAG,GAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAgD,GACrE,OAAO,CAAC,UAAU,CAAC,CAuDrB;AAED;;GAEG;AACH,wBAAgB,KAAK,IAAI,MAAM,CAiB9B;AAED;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,WAAW,CAO1D;AAED,qEAAqE;AACrE,wBAAsB,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,MAAM,CAAC,CAiC9D"}
|