@fingerskier/augment 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.
- package/LICENSE +201 -0
- package/README.md +130 -0
- package/dist/bin/augment-daemon.d.ts +2 -0
- package/dist/bin/augment-daemon.js +5 -0
- package/dist/bin/augment-daemon.js.map +1 -0
- package/dist/bin/augment-mcp.d.ts +2 -0
- package/dist/bin/augment-mcp.js +5 -0
- package/dist/bin/augment-mcp.js.map +1 -0
- package/dist/bin/augment.d.ts +2 -0
- package/dist/bin/augment.js +5 -0
- package/dist/bin/augment.js.map +1 -0
- package/dist/cli.d.ts +1 -0
- package/dist/cli.js +13 -0
- package/dist/cli.js.map +1 -0
- package/dist/config.d.ts +9 -0
- package/dist/config.js +57 -0
- package/dist/config.js.map +1 -0
- package/dist/constants.d.ts +11 -0
- package/dist/constants.js +10 -0
- package/dist/constants.js.map +1 -0
- package/dist/daemon/client.d.ts +19 -0
- package/dist/daemon/client.js +146 -0
- package/dist/daemon/client.js.map +1 -0
- package/dist/daemon/http.d.ts +8 -0
- package/dist/daemon/http.js +142 -0
- package/dist/daemon/http.js.map +1 -0
- package/dist/daemon/main.d.ts +1 -0
- package/dist/daemon/main.js +16 -0
- package/dist/daemon/main.js.map +1 -0
- package/dist/db.d.ts +33 -0
- package/dist/db.js +338 -0
- package/dist/db.js.map +1 -0
- package/dist/embeddings.d.ts +20 -0
- package/dist/embeddings.js +35 -0
- package/dist/embeddings.js.map +1 -0
- package/dist/mcp/server.d.ts +1 -0
- package/dist/mcp/server.js +91 -0
- package/dist/mcp/server.js.map +1 -0
- package/dist/memory/files.d.ts +11 -0
- package/dist/memory/files.js +107 -0
- package/dist/memory/files.js.map +1 -0
- package/dist/memory/project.d.ts +8 -0
- package/dist/memory/project.js +59 -0
- package/dist/memory/project.js.map +1 -0
- package/dist/memory/scan.d.ts +1 -0
- package/dist/memory/scan.js +29 -0
- package/dist/memory/scan.js.map +1 -0
- package/dist/service.d.ts +43 -0
- package/dist/service.js +339 -0
- package/dist/service.js.map +1 -0
- package/dist/types.d.ts +95 -0
- package/dist/types.js +2 -0
- package/dist/types.js.map +1 -0
- package/dist/util/hash.d.ts +3 -0
- package/dist/util/hash.js +25 -0
- package/dist/util/hash.js.map +1 -0
- package/dist/util/text.d.ts +4 -0
- package/dist/util/text.js +42 -0
- package/dist/util/text.js.map +1 -0
- package/docs/FEATURES.md +245 -0
- package/integrations/claude/CLAUDE.md +28 -0
- package/integrations/codex/SKILL.md +29 -0
- package/integrations/examples/claude-mcp-config.json +11 -0
- package/integrations/examples/codex-mcp-config.json +11 -0
- package/package.json +45 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright [yyyy] [name of copyright owner]
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
package/README.md
ADDED
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
# augment
|
|
2
|
+
|
|
3
|
+
Local RAG memory for coding agents.
|
|
4
|
+
|
|
5
|
+
Augment stores durable memories as markdown files, maintains a local rebuildable index, and exposes the memory system through an MCP server.
|
|
6
|
+
The MCP server connects to a shared local daemon, so multiple coding agents can use the same memory folder without each running its own watcher/indexer.
|
|
7
|
+
|
|
8
|
+
Feature details live in [docs/FEATURES.md](docs/FEATURES.md).
|
|
9
|
+
The implementation plan lives in [PLAN.md](PLAN.md).
|
|
10
|
+
|
|
11
|
+
----
|
|
12
|
+
|
|
13
|
+
## Install
|
|
14
|
+
|
|
15
|
+
From this repo:
|
|
16
|
+
|
|
17
|
+
```powershell
|
|
18
|
+
npm install
|
|
19
|
+
npm run build
|
|
20
|
+
npm run check
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
---
|
|
24
|
+
|
|
25
|
+
## Configure Memory
|
|
26
|
+
|
|
27
|
+
For quick local testing, set the memory root with an environment variable:
|
|
28
|
+
|
|
29
|
+
```powershell
|
|
30
|
+
$env:AUGMENT_MEMORY_ROOT = "C:\Users\you\Dropbox\augment-memories"
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
Or create `~/.augment/config.json`:
|
|
34
|
+
|
|
35
|
+
```json
|
|
36
|
+
{
|
|
37
|
+
"memoryRoot": "C:\\Users\\you\\Dropbox\\augment-memories",
|
|
38
|
+
"stateDir": "C:\\Users\\you\\.augment\\state"
|
|
39
|
+
}
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
Defaults:
|
|
43
|
+
|
|
44
|
+
- Memory root: `~/.augment/memories`
|
|
45
|
+
- State directory: `~/.augment/state`
|
|
46
|
+
|
|
47
|
+
## Run Locally
|
|
48
|
+
|
|
49
|
+
Run diagnostics:
|
|
50
|
+
|
|
51
|
+
```powershell
|
|
52
|
+
node .\dist\bin\augment.js status
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
Start the daemon manually:
|
|
56
|
+
|
|
57
|
+
```powershell
|
|
58
|
+
node .\dist\bin\augment-daemon.js
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
Normally you do not need to start the daemon yourself. `augment-mcp` starts or
|
|
62
|
+
connects to the shared daemon automatically.
|
|
63
|
+
|
|
64
|
+
Run the MCP server manually:
|
|
65
|
+
|
|
66
|
+
```powershell
|
|
67
|
+
node .\dist\bin\augment-mcp.js
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
It will appear idle in a terminal because it speaks MCP over stdio.
|
|
71
|
+
|
|
72
|
+
## Local MCP Config
|
|
73
|
+
|
|
74
|
+
Use the compiled local MCP bin while dogfooding:
|
|
75
|
+
|
|
76
|
+
```json
|
|
77
|
+
{
|
|
78
|
+
"mcpServers": {
|
|
79
|
+
"augment": {
|
|
80
|
+
"command": "node",
|
|
81
|
+
"args": ["C:\\dev\\fingerskier\\agent\\augment\\dist\\bin\\augment-mcp.js"],
|
|
82
|
+
"env": {
|
|
83
|
+
"AUGMENT_MEMORY_ROOT": "C:\\Users\\you\\Dropbox\\augment-memories"
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
Alternative using npm from another working directory:
|
|
91
|
+
|
|
92
|
+
```json
|
|
93
|
+
{
|
|
94
|
+
"mcpServers": {
|
|
95
|
+
"augment": {
|
|
96
|
+
"command": "npm",
|
|
97
|
+
"args": [
|
|
98
|
+
"exec",
|
|
99
|
+
"--prefix",
|
|
100
|
+
"C:\\dev\\fingerskier\\agent\\augment",
|
|
101
|
+
"--",
|
|
102
|
+
"augment-mcp"
|
|
103
|
+
],
|
|
104
|
+
"env": {
|
|
105
|
+
"AUGMENT_MEMORY_ROOT": "C:\\Users\\you\\Dropbox\\augment-memories"
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
Dogfooding instructions:
|
|
113
|
+
|
|
114
|
+
- Codex: [integrations/codex/SKILL.md](integrations/codex/SKILL.md)
|
|
115
|
+
- Claude: [integrations/claude/CLAUDE.md](integrations/claude/CLAUDE.md)
|
|
116
|
+
|
|
117
|
+
## Package Check
|
|
118
|
+
|
|
119
|
+
Before publishing:
|
|
120
|
+
|
|
121
|
+
```powershell
|
|
122
|
+
npm run check
|
|
123
|
+
npm pack --dry-run
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
The package exposes these bins:
|
|
127
|
+
|
|
128
|
+
- `augment`
|
|
129
|
+
- `augment-daemon`
|
|
130
|
+
- `augment-mcp`
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"augment-daemon.js","sourceRoot":"","sources":["../../src/bin/augment-daemon.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAEvD,OAAO,CAAC,KAAK,GAAG,gBAAgB,CAAC;AAEjC,MAAM,kBAAkB,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"augment-mcp.js","sourceRoot":"","sources":["../../src/bin/augment-mcp.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAElD,OAAO,CAAC,KAAK,GAAG,aAAa,CAAC;AAE9B,MAAM,cAAc,EAAE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"augment.js","sourceRoot":"","sources":["../../src/bin/augment.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAEnC,OAAO,CAAC,KAAK,GAAG,SAAS,CAAC;AAE1B,MAAM,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC"}
|
package/dist/cli.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function runCli(args: string[]): Promise<void>;
|
package/dist/cli.js
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { loadConfig } from "./config.js";
|
|
2
|
+
export async function runCli(args) {
|
|
3
|
+
const command = args[0] ?? "status";
|
|
4
|
+
if (command === "config" || command === "status") {
|
|
5
|
+
const config = await loadConfig();
|
|
6
|
+
console.log(JSON.stringify(config, null, 2));
|
|
7
|
+
return;
|
|
8
|
+
}
|
|
9
|
+
console.error(`Unknown command: ${command}`);
|
|
10
|
+
console.error("Usage: augment [status|config]");
|
|
11
|
+
process.exitCode = 1;
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=cli.js.map
|
package/dist/cli.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEzC,MAAM,CAAC,KAAK,UAAU,MAAM,CAAC,IAAc;IACzC,MAAM,OAAO,GAAG,IAAI,CAAC,CAAC,CAAC,IAAI,QAAQ,CAAC;IAEpC,IAAI,OAAO,KAAK,QAAQ,IAAI,OAAO,KAAK,QAAQ,EAAE,CAAC;QACjD,MAAM,MAAM,GAAG,MAAM,UAAU,EAAE,CAAC;QAClC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;QAC7C,OAAO;IACT,CAAC;IAED,OAAO,CAAC,KAAK,CAAC,oBAAoB,OAAO,EAAE,CAAC,CAAC;IAC7C,OAAO,CAAC,KAAK,CAAC,gCAAgC,CAAC,CAAC;IAChD,OAAO,CAAC,QAAQ,GAAG,CAAC,CAAC;AACvB,CAAC"}
|
package/dist/config.d.ts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export interface AugmentConfig {
|
|
2
|
+
memoryRoot: string;
|
|
3
|
+
stateDir: string;
|
|
4
|
+
databasePath: string;
|
|
5
|
+
daemonFile: string;
|
|
6
|
+
daemonPort?: number;
|
|
7
|
+
}
|
|
8
|
+
export declare function loadConfig(): Promise<AugmentConfig>;
|
|
9
|
+
export declare function ensureConfigDirs(config: AugmentConfig): Promise<void>;
|
package/dist/config.js
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { mkdir, readFile } from "node:fs/promises";
|
|
2
|
+
import { homedir } from "node:os";
|
|
3
|
+
import path from "node:path";
|
|
4
|
+
function expandHome(value) {
|
|
5
|
+
if (value === "~") {
|
|
6
|
+
return homedir();
|
|
7
|
+
}
|
|
8
|
+
if (value.startsWith("~/") || value.startsWith("~\\")) {
|
|
9
|
+
return path.join(homedir(), value.slice(2));
|
|
10
|
+
}
|
|
11
|
+
return value;
|
|
12
|
+
}
|
|
13
|
+
function absolutePath(value) {
|
|
14
|
+
return path.resolve(expandHome(value));
|
|
15
|
+
}
|
|
16
|
+
async function readConfigFile(configPath) {
|
|
17
|
+
try {
|
|
18
|
+
const raw = await readFile(configPath, "utf8");
|
|
19
|
+
return JSON.parse(raw);
|
|
20
|
+
}
|
|
21
|
+
catch (error) {
|
|
22
|
+
const code = error.code;
|
|
23
|
+
if (code === "ENOENT") {
|
|
24
|
+
return {};
|
|
25
|
+
}
|
|
26
|
+
throw error;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
function parseOptionalPort(value) {
|
|
30
|
+
if (!value) {
|
|
31
|
+
return undefined;
|
|
32
|
+
}
|
|
33
|
+
const parsed = Number(value);
|
|
34
|
+
if (!Number.isInteger(parsed) || parsed <= 0 || parsed > 65535) {
|
|
35
|
+
throw new Error(`Invalid AUGMENT_DAEMON_PORT: ${value}`);
|
|
36
|
+
}
|
|
37
|
+
return parsed;
|
|
38
|
+
}
|
|
39
|
+
export async function loadConfig() {
|
|
40
|
+
const configPath = path.join(homedir(), ".augment", "config.json");
|
|
41
|
+
const fileConfig = await readConfigFile(configPath);
|
|
42
|
+
const memoryRoot = absolutePath(process.env.AUGMENT_MEMORY_ROOT ?? fileConfig.memoryRoot ?? "~/.augment/memories");
|
|
43
|
+
const stateDir = absolutePath(process.env.AUGMENT_STATE_DIR ?? fileConfig.stateDir ?? "~/.augment/state");
|
|
44
|
+
const daemonPort = parseOptionalPort(process.env.AUGMENT_DAEMON_PORT) ?? fileConfig.daemonPort;
|
|
45
|
+
return {
|
|
46
|
+
memoryRoot,
|
|
47
|
+
stateDir,
|
|
48
|
+
databasePath: path.join(stateDir, "index.db"),
|
|
49
|
+
daemonFile: path.join(stateDir, "daemon.json"),
|
|
50
|
+
daemonPort,
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
export async function ensureConfigDirs(config) {
|
|
54
|
+
await mkdir(config.memoryRoot, { recursive: true });
|
|
55
|
+
await mkdir(config.stateDir, { recursive: true });
|
|
56
|
+
}
|
|
57
|
+
//# sourceMappingURL=config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export declare const PACKAGE_NAME = "@fingerskier/augment";
|
|
2
|
+
export declare const DEFAULT_MEMORY_SOFT_LIMIT_CHARS = 4000;
|
|
3
|
+
export declare const DEFAULT_MEMORY_HARD_LIMIT_CHARS = 12000;
|
|
4
|
+
export declare const DEFAULT_SEARCH_LIMIT = 5;
|
|
5
|
+
export declare const DEFAULT_SEARCH_MAX_CHARS = 12000;
|
|
6
|
+
export declare const EMBEDDING_MODEL_ID = "Xenova/bge-small-en-v1.5";
|
|
7
|
+
export declare const EMBEDDING_DIMENSIONS = 384;
|
|
8
|
+
export declare const MEMORY_KINDS: readonly ["ISSUE", "ARCH", "TODO", "SPEC", "WORK"];
|
|
9
|
+
export type MemoryKind = (typeof MEMORY_KINDS)[number];
|
|
10
|
+
export declare const LINK_TYPES: readonly ["DEPENDS_ON", "BLOCKS", "IMPLEMENTS", "PARENT", "RELATED"];
|
|
11
|
+
export type LinkType = (typeof LINK_TYPES)[number];
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export const PACKAGE_NAME = "@fingerskier/augment";
|
|
2
|
+
export const DEFAULT_MEMORY_SOFT_LIMIT_CHARS = 4_000;
|
|
3
|
+
export const DEFAULT_MEMORY_HARD_LIMIT_CHARS = 12_000;
|
|
4
|
+
export const DEFAULT_SEARCH_LIMIT = 5;
|
|
5
|
+
export const DEFAULT_SEARCH_MAX_CHARS = 12_000;
|
|
6
|
+
export const EMBEDDING_MODEL_ID = "Xenova/bge-small-en-v1.5";
|
|
7
|
+
export const EMBEDDING_DIMENSIONS = 384;
|
|
8
|
+
export const MEMORY_KINDS = ["ISSUE", "ARCH", "TODO", "SPEC", "WORK"];
|
|
9
|
+
export const LINK_TYPES = ["DEPENDS_ON", "BLOCKS", "IMPLEMENTS", "PARENT", "RELATED"];
|
|
10
|
+
//# sourceMappingURL=constants.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,YAAY,GAAG,sBAAsB,CAAC;AACnD,MAAM,CAAC,MAAM,+BAA+B,GAAG,KAAK,CAAC;AACrD,MAAM,CAAC,MAAM,+BAA+B,GAAG,MAAM,CAAC;AACtD,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,CAAC;AACtC,MAAM,CAAC,MAAM,wBAAwB,GAAG,MAAM,CAAC;AAC/C,MAAM,CAAC,MAAM,kBAAkB,GAAG,0BAA0B,CAAC;AAC7D,MAAM,CAAC,MAAM,oBAAoB,GAAG,GAAG,CAAC;AAExC,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAU,CAAC;AAG/E,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,YAAY,EAAE,QAAQ,EAAE,YAAY,EAAE,QAAQ,EAAE,SAAS,CAAU,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { type AugmentConfig } from "../config.js";
|
|
2
|
+
import type { DaemonInfo } from "../types.js";
|
|
3
|
+
export declare class DaemonClient {
|
|
4
|
+
private readonly info;
|
|
5
|
+
constructor(info: DaemonInfo);
|
|
6
|
+
initProject(input: unknown): Promise<unknown>;
|
|
7
|
+
listProjects(name?: string): Promise<unknown>;
|
|
8
|
+
search(input: unknown): Promise<unknown>;
|
|
9
|
+
upsert(input: unknown): Promise<unknown>;
|
|
10
|
+
read(id: number): Promise<unknown>;
|
|
11
|
+
link(input: unknown): Promise<unknown>;
|
|
12
|
+
listLinks(memoryId: number): Promise<unknown>;
|
|
13
|
+
unlink(id: number): Promise<unknown>;
|
|
14
|
+
private get;
|
|
15
|
+
private post;
|
|
16
|
+
private delete;
|
|
17
|
+
private request;
|
|
18
|
+
}
|
|
19
|
+
export declare function connectOrStartDaemon(config?: AugmentConfig): Promise<DaemonClient>;
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
import { spawn } from "node:child_process";
|
|
2
|
+
import { constants } from "node:fs";
|
|
3
|
+
import { open, readFile, rm, writeFile } from "node:fs/promises";
|
|
4
|
+
import path from "node:path";
|
|
5
|
+
import { fileURLToPath } from "node:url";
|
|
6
|
+
import { ensureConfigDirs, loadConfig } from "../config.js";
|
|
7
|
+
export class DaemonClient {
|
|
8
|
+
info;
|
|
9
|
+
constructor(info) {
|
|
10
|
+
this.info = info;
|
|
11
|
+
}
|
|
12
|
+
async initProject(input) {
|
|
13
|
+
return this.post("/projects/init", input);
|
|
14
|
+
}
|
|
15
|
+
async listProjects(name) {
|
|
16
|
+
const suffix = name ? `?name=${encodeURIComponent(name)}` : "";
|
|
17
|
+
return this.get(`/projects${suffix}`);
|
|
18
|
+
}
|
|
19
|
+
async search(input) {
|
|
20
|
+
return this.post("/memories/search", input);
|
|
21
|
+
}
|
|
22
|
+
async upsert(input) {
|
|
23
|
+
return this.post("/memories/upsert", input);
|
|
24
|
+
}
|
|
25
|
+
async read(id) {
|
|
26
|
+
return this.get(`/memories/${id}`);
|
|
27
|
+
}
|
|
28
|
+
async link(input) {
|
|
29
|
+
return this.post("/links", input);
|
|
30
|
+
}
|
|
31
|
+
async listLinks(memoryId) {
|
|
32
|
+
return this.get(`/links?memory_id=${encodeURIComponent(String(memoryId))}`);
|
|
33
|
+
}
|
|
34
|
+
async unlink(id) {
|
|
35
|
+
return this.delete(`/links/${id}`);
|
|
36
|
+
}
|
|
37
|
+
async get(pathname) {
|
|
38
|
+
return this.request("GET", pathname);
|
|
39
|
+
}
|
|
40
|
+
async post(pathname, body) {
|
|
41
|
+
return this.request("POST", pathname, body);
|
|
42
|
+
}
|
|
43
|
+
async delete(pathname) {
|
|
44
|
+
return this.request("DELETE", pathname);
|
|
45
|
+
}
|
|
46
|
+
async request(method, pathname, body) {
|
|
47
|
+
const response = await fetch(new URL(pathname, this.info.endpoint), {
|
|
48
|
+
method,
|
|
49
|
+
headers: {
|
|
50
|
+
authorization: `Bearer ${this.info.token}`,
|
|
51
|
+
"content-type": "application/json",
|
|
52
|
+
},
|
|
53
|
+
body: body === undefined ? undefined : JSON.stringify(body),
|
|
54
|
+
});
|
|
55
|
+
const payload = (await response.json().catch(() => ({})));
|
|
56
|
+
if (!response.ok) {
|
|
57
|
+
throw new Error(String(payload.error ?? `${method} ${pathname} failed with ${response.status}`));
|
|
58
|
+
}
|
|
59
|
+
return payload;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
export async function connectOrStartDaemon(config) {
|
|
63
|
+
config ??= await loadConfig();
|
|
64
|
+
await ensureConfigDirs(config);
|
|
65
|
+
const existing = await readDaemonInfo(config);
|
|
66
|
+
if (existing && (await isHealthy(existing, config))) {
|
|
67
|
+
return new DaemonClient(existing);
|
|
68
|
+
}
|
|
69
|
+
await withDaemonLock(config, async () => {
|
|
70
|
+
const afterLock = await readDaemonInfo(config);
|
|
71
|
+
if (afterLock && (await isHealthy(afterLock, config))) {
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
74
|
+
await startDaemonProcess();
|
|
75
|
+
await waitForDaemon(config);
|
|
76
|
+
});
|
|
77
|
+
const info = await readDaemonInfo(config);
|
|
78
|
+
if (!info || !(await isHealthy(info, config))) {
|
|
79
|
+
throw new Error("Failed to start augment daemon");
|
|
80
|
+
}
|
|
81
|
+
return new DaemonClient(info);
|
|
82
|
+
}
|
|
83
|
+
async function readDaemonInfo(config) {
|
|
84
|
+
try {
|
|
85
|
+
return JSON.parse(await readFile(config.daemonFile, "utf8"));
|
|
86
|
+
}
|
|
87
|
+
catch {
|
|
88
|
+
return undefined;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
async function isHealthy(info, config) {
|
|
92
|
+
if (info.memoryRoot !== config.memoryRoot) {
|
|
93
|
+
return false;
|
|
94
|
+
}
|
|
95
|
+
try {
|
|
96
|
+
const response = await fetch(new URL("/health", info.endpoint), { signal: AbortSignal.timeout(1_000) });
|
|
97
|
+
return response.ok;
|
|
98
|
+
}
|
|
99
|
+
catch {
|
|
100
|
+
return false;
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
async function waitForDaemon(config) {
|
|
104
|
+
const deadline = Date.now() + 15_000;
|
|
105
|
+
while (Date.now() < deadline) {
|
|
106
|
+
const info = await readDaemonInfo(config);
|
|
107
|
+
if (info && (await isHealthy(info, config))) {
|
|
108
|
+
return;
|
|
109
|
+
}
|
|
110
|
+
await new Promise((resolve) => setTimeout(resolve, 250));
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
async function withDaemonLock(config, callback) {
|
|
114
|
+
const lockPath = path.join(config.stateDir, "daemon.lock");
|
|
115
|
+
let handle;
|
|
116
|
+
const deadline = Date.now() + 10_000;
|
|
117
|
+
while (!handle) {
|
|
118
|
+
try {
|
|
119
|
+
handle = await open(lockPath, constants.O_CREAT | constants.O_EXCL | constants.O_RDWR);
|
|
120
|
+
}
|
|
121
|
+
catch {
|
|
122
|
+
if (Date.now() > deadline) {
|
|
123
|
+
throw new Error(`Timed out waiting for daemon lock: ${lockPath}`);
|
|
124
|
+
}
|
|
125
|
+
await new Promise((resolve) => setTimeout(resolve, 200));
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
try {
|
|
129
|
+
await writeFile(lockPath, String(process.pid), "utf8");
|
|
130
|
+
await callback();
|
|
131
|
+
}
|
|
132
|
+
finally {
|
|
133
|
+
await handle.close();
|
|
134
|
+
await rm(lockPath, { force: true });
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
async function startDaemonProcess() {
|
|
138
|
+
const daemonScript = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "../bin/augment-daemon.js");
|
|
139
|
+
const child = spawn(process.execPath, [daemonScript], {
|
|
140
|
+
detached: true,
|
|
141
|
+
stdio: "ignore",
|
|
142
|
+
windowsHide: true,
|
|
143
|
+
});
|
|
144
|
+
child.unref();
|
|
145
|
+
}
|
|
146
|
+
//# sourceMappingURL=client.js.map
|