htm-cli 0.2.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.
- checksums.yaml +7 -0
- data/CHANGELOG.md +11 -0
- data/COMMITS.md +196 -0
- data/LICENSE.txt +21 -0
- data/README.md +99 -0
- data/Rakefile +23 -0
- data/bin/htm +18 -0
- data/lib/htm/admin/database_commands.rb +489 -0
- data/lib/htm/admin/enrich_commands.rb +275 -0
- data/lib/htm/admin/entity_commands.rb +203 -0
- data/lib/htm/admin/entity_graph.rb +313 -0
- data/lib/htm/admin/file_commands.rb +323 -0
- data/lib/htm/admin/memory_commands/edit.rb +175 -0
- data/lib/htm/admin/memory_commands/entities.rb +189 -0
- data/lib/htm/admin/memory_commands/entity_lines.rb +111 -0
- data/lib/htm/admin/memory_commands/search.rb +205 -0
- data/lib/htm/admin/memory_commands/tag_search.rb +98 -0
- data/lib/htm/admin/memory_commands/text.rb +166 -0
- data/lib/htm/admin/memory_commands/working_memory.rb +71 -0
- data/lib/htm/admin/memory_commands.rb +196 -0
- data/lib/htm/admin/tag_commands.rb +352 -0
- data/lib/htm/admin/tag_graph.rb +345 -0
- data/lib/htm/admin/templates/tag_graph.html +319 -0
- data/lib/htm/admin.rb +266 -0
- data/lib/htm/cli/config_file.rb +73 -0
- data/lib/htm/cli/db.rb +80 -0
- data/lib/htm/cli/enrich.rb +52 -0
- data/lib/htm/cli/entities.rb +268 -0
- data/lib/htm/cli/environment.rb +74 -0
- data/lib/htm/cli/error_suggestion.rb +97 -0
- data/lib/htm/cli/files.rb +41 -0
- data/lib/htm/cli/group.rb +46 -0
- data/lib/htm/cli/memory.rb +410 -0
- data/lib/htm/cli/memory_command.rb +72 -0
- data/lib/htm/cli/robots.rb +82 -0
- data/lib/htm/cli/support.rb +46 -0
- data/lib/htm/cli/tags.rb +103 -0
- data/lib/htm/cli/version.rb +11 -0
- data/lib/htm/cli/working_memory.rb +41 -0
- data/lib/htm/cli.rb +96 -0
- data/lib/htm/mcp/entity_tools.rb +334 -0
- data/lib/htm/mcp/file_tools.rb +196 -0
- data/lib/htm/mcp/group_tools.rb +466 -0
- data/lib/htm/mcp/node_tools.rb +358 -0
- data/lib/htm/mcp/resources.rb +192 -0
- data/lib/htm/mcp/robot_team_tools.rb +129 -0
- data/lib/htm/mcp/server.rb +111 -0
- data/lib/htm/mcp/tag_tools.rb +130 -0
- data/lib/htm/mcp/tool.rb +40 -0
- data/lib/htm/mcp/tool_support.rb +108 -0
- data/lib/htm/mcp/tools.rb +461 -0
- metadata +181 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: 4df6d4fccb34779aba6441fc2438efee7bfd6c524154db839abebfe1525ea25f
|
|
4
|
+
data.tar.gz: 4282a982ee80b788584625994f86a125990fff40cd7116d4ea929ffac9d3e387
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: a3b0d551ea273f3f9ed8d9cbf68c828fc208700100fd44d71fa9928d21ecbe99901d265a40e0b4551cace529296c457dc9d9fe4e2de5afdecbf2624fadfd062e
|
|
7
|
+
data.tar.gz: f93d4211b4de1945a773f1e38bc93d9caaa7eed2b125f26cca514f0ded86074d4e1f45aa74b32cb8ea975ca1e2b1712f55d58053da7aaa8a518abfc340971c1c
|
data/CHANGELOG.md
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
## [Unreleased]
|
|
2
|
+
|
|
3
|
+
## [0.2.0] - 2026-12-06
|
|
4
|
+
|
|
5
|
+
- `Archspec.rb` states the designed architecture (the Thor commands and the MCP server as two front ends over `HTM::Admin`, which knows neither) and the ArchSpec gate of `asgard quality` checks it.
|
|
6
|
+
|
|
7
|
+
- The `htm` command line (`HTM::CLI`), the MCP server (`HTM::MCP`) and the
|
|
8
|
+
commands behind them (`HTM::Admin`), moved here from the htm gem, which
|
|
9
|
+
carried them up to 0.1.1. Requires htm 0.2.x.
|
|
10
|
+
- `htm version` prints both versions: `htm-cli 0.2.0 (htm 0.2.0)`.
|
|
11
|
+
- `examples/`: the named-entity shell-script walkthrough, moved here from the htm repository (`examples/ner_cli_script_examples`). Its `.envrc` now sets the database host, port, user and the LM Studio models itself.
|
data/COMMITS.md
ADDED
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
---
|
|
2
|
+
url: https://www.conventionalcommits.org/en/v1.0.0/
|
|
3
|
+
title: Conventional Commits
|
|
4
|
+
description: A specification for adding human and machine readable meaning to commit messages
|
|
5
|
+
access_date: 2025-07-31T20:51:29.000Z
|
|
6
|
+
current_date: 2025-07-31T20:51:29.601Z
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# Conventional Commits
|
|
10
|
+
|
|
11
|
+
A specification for adding human and machine readable meaning to commit messages
|
|
12
|
+
|
|
13
|
+
Quick Summary Full Specification Contribute
|
|
14
|
+
|
|
15
|
+
# Conventional Commits 1.0.0
|
|
16
|
+
|
|
17
|
+
## Summary
|
|
18
|
+
|
|
19
|
+
The Conventional Commits specification is a lightweight convention on top of commit messages. It provides an easy set of rules for creating an explicit commit history; which makes it easier to write automated tools on top of. This convention dovetails with SemVer, by describing the features, fixes, and breaking changes made in commit messages.
|
|
20
|
+
|
|
21
|
+
The commit message should be structured as follows:
|
|
22
|
+
|
|
23
|
+
---
|
|
24
|
+
|
|
25
|
+
```
|
|
26
|
+
<type>[optional scope]: <description>
|
|
27
|
+
|
|
28
|
+
[optional body]
|
|
29
|
+
|
|
30
|
+
[optional footer(s)]
|
|
31
|
+
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
---
|
|
35
|
+
|
|
36
|
+
The commit contains the following structural elements, to communicate intent to the consumers of your library:
|
|
37
|
+
|
|
38
|
+
1. **fix:** a commit of the _type_ `fix` patches a bug in your codebase (this correlates with `PATCH` in Semantic Versioning).
|
|
39
|
+
2. **feat:** a commit of the _type_ `feat` introduces a new feature to the codebase (this correlates with `MINOR` in Semantic Versioning).
|
|
40
|
+
3. **BREAKING CHANGE:** a commit that has a footer `BREAKING CHANGE:`, or appends a `!` after the type/scope, introduces a breaking API change (correlating with `MAJOR` in Semantic Versioning). A BREAKING CHANGE can be part of commits of any _type_.
|
|
41
|
+
4. _types_ other than `fix:` and `feat:` are allowed, for example @commitlint/config-conventional (based on the Angular convention) recommends `build:`, `chore:`,`ci:`, `docs:`, `style:`, `refactor:`, `perf:`, `test:`, and others.
|
|
42
|
+
5. _footers_ other than `BREAKING CHANGE: <description>` may be provided and follow a convention similar to git trailer format.
|
|
43
|
+
|
|
44
|
+
Additional types are not mandated by the Conventional Commits specification, and have no implicit effect in Semantic Versioning (unless they include a BREAKING CHANGE). A scope may be provided to a commit’s type, to provide additional contextual information and is contained within parenthesis, e.g., `feat(parser): add ability to parse arrays`.
|
|
45
|
+
|
|
46
|
+
## Examples
|
|
47
|
+
|
|
48
|
+
### Commit message with description and breaking change footer
|
|
49
|
+
|
|
50
|
+
```
|
|
51
|
+
feat: allow provided config object to extend other configs
|
|
52
|
+
|
|
53
|
+
BREAKING CHANGE: `extends` key in config file is now used for extending other config files
|
|
54
|
+
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
### Commit message with `!` to draw attention to breaking change
|
|
58
|
+
|
|
59
|
+
```
|
|
60
|
+
feat!: send an email to the customer when a product is shipped
|
|
61
|
+
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
### Commit message with scope and `!` to draw attention to breaking change
|
|
65
|
+
|
|
66
|
+
```
|
|
67
|
+
feat(api)!: send an email to the customer when a product is shipped
|
|
68
|
+
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
### Commit message with both `!` and BREAKING CHANGE footer
|
|
72
|
+
|
|
73
|
+
```
|
|
74
|
+
chore!: drop support for Node 6
|
|
75
|
+
|
|
76
|
+
BREAKING CHANGE: use JavaScript features not available in Node 6.
|
|
77
|
+
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
### Commit message with no body
|
|
81
|
+
|
|
82
|
+
```
|
|
83
|
+
docs: correct spelling of CHANGELOG
|
|
84
|
+
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
### Commit message with scope
|
|
88
|
+
|
|
89
|
+
```
|
|
90
|
+
feat(lang): add Polish language
|
|
91
|
+
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
### Commit message with multi-paragraph body and multiple footers
|
|
95
|
+
|
|
96
|
+
```
|
|
97
|
+
fix: prevent racing of requests
|
|
98
|
+
|
|
99
|
+
Introduce a request id and a reference to latest request. Dismiss
|
|
100
|
+
incoming responses other than from latest request.
|
|
101
|
+
|
|
102
|
+
Remove timeouts which were used to mitigate the racing issue but are
|
|
103
|
+
obsolete now.
|
|
104
|
+
|
|
105
|
+
Reviewed-by: Z
|
|
106
|
+
Refs: #123
|
|
107
|
+
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
## Specification
|
|
111
|
+
|
|
112
|
+
The key words “MUST”, “MUST NOT”, “REQUIRED”, “SHALL”, “SHALL NOT”, “SHOULD”, “SHOULD NOT”, “RECOMMENDED”, “MAY”, and “OPTIONAL” in this document are to be interpreted as described in RFC 2119.
|
|
113
|
+
|
|
114
|
+
1. Commits MUST be prefixed with a type, which consists of a noun, `feat`, `fix`, etc., followed by the OPTIONAL scope, OPTIONAL `!`, and REQUIRED terminal colon and space.
|
|
115
|
+
2. The type `feat` MUST be used when a commit adds a new feature to your application or library.
|
|
116
|
+
3. The type `fix` MUST be used when a commit represents a bug fix for your application.
|
|
117
|
+
4. A scope MAY be provided after a type. A scope MUST consist of a noun describing a section of the codebase surrounded by parenthesis, e.g., `fix(parser):`
|
|
118
|
+
5. A description MUST immediately follow the colon and space after the type/scope prefix. The description is a short summary of the code changes, e.g., _fix: array parsing issue when multiple spaces were contained in string_.
|
|
119
|
+
6. A longer commit body MAY be provided after the short description, providing additional contextual information about the code changes. The body MUST begin one blank line after the description.
|
|
120
|
+
7. A commit body is free-form and MAY consist of any number of newline separated paragraphs.
|
|
121
|
+
8. One or more footers MAY be provided one blank line after the body. Each footer MUST consist of a word token, followed by either a `:<space>` or `<space>#` separator, followed by a string value (this is inspired by the git trailer convention).
|
|
122
|
+
9. A footer’s token MUST use `-` in place of whitespace characters, e.g., `Acked-by` (this helps differentiate the footer section from a multi-paragraph body). An exception is made for `BREAKING CHANGE`, which MAY also be used as a token.
|
|
123
|
+
10. A footer’s value MAY contain spaces and newlines, and parsing MUST terminate when the next valid footer token/separator pair is observed.
|
|
124
|
+
11. Breaking changes MUST be indicated in the type/scope prefix of a commit, or as an entry in the footer.
|
|
125
|
+
12. If included as a footer, a breaking change MUST consist of the uppercase text BREAKING CHANGE, followed by a colon, space, and description, e.g.,_BREAKING CHANGE: environment variables now take precedence over config files_.
|
|
126
|
+
13. If included in the type/scope prefix, breaking changes MUST be indicated by a`!` immediately before the `:`. If `!` is used, `BREAKING CHANGE:` MAY be omitted from the footer section, and the commit description SHALL be used to describe the breaking change.
|
|
127
|
+
14. Types other than `feat` and `fix` MAY be used in your commit messages, e.g., _docs: update ref docs._
|
|
128
|
+
15. The units of information that make up Conventional Commits MUST NOT be treated as case sensitive by implementors, with the exception of BREAKING CHANGE which MUST be uppercase.
|
|
129
|
+
16. BREAKING-CHANGE MUST be synonymous with BREAKING CHANGE, when used as a token in a footer.
|
|
130
|
+
|
|
131
|
+
## Why Use Conventional Commits
|
|
132
|
+
|
|
133
|
+
* Automatically generating CHANGELOGs.
|
|
134
|
+
* Automatically determining a semantic version bump (based on the types of commits landed).
|
|
135
|
+
* Communicating the nature of changes to teammates, the public, and other stakeholders.
|
|
136
|
+
* Triggering build and publish processes.
|
|
137
|
+
* Making it easier for people to contribute to your projects, by allowing them to explore a more structured commit history.
|
|
138
|
+
|
|
139
|
+
## FAQ
|
|
140
|
+
|
|
141
|
+
### How should I deal with commit messages in the initial development phase?
|
|
142
|
+
|
|
143
|
+
We recommend that you proceed as if you’ve already released the product. Typically _somebody_, even if it’s your fellow software developers, is using your software. They’ll want to know what’s fixed, what breaks etc.
|
|
144
|
+
|
|
145
|
+
### Are the types in the commit title uppercase or lowercase?
|
|
146
|
+
|
|
147
|
+
Any casing may be used, but it’s best to be consistent.
|
|
148
|
+
|
|
149
|
+
### What do I do if the commit conforms to more than one of the commit types?
|
|
150
|
+
|
|
151
|
+
Go back and make multiple commits whenever possible. Part of the benefit of Conventional Commits is its ability to drive us to make more organized commits and PRs.
|
|
152
|
+
|
|
153
|
+
### Doesn’t this discourage rapid development and fast iteration?
|
|
154
|
+
|
|
155
|
+
It discourages moving fast in a disorganized way. It helps you be able to move fast long term across multiple projects with varied contributors.
|
|
156
|
+
|
|
157
|
+
### Might Conventional Commits lead developers to limit the type of commits they make because they’ll be thinking in the types provided?
|
|
158
|
+
|
|
159
|
+
Conventional Commits encourages us to make more of certain types of commits such as fixes. Other than that, the flexibility of Conventional Commits allows your team to come up with their own types and change those types over time.
|
|
160
|
+
|
|
161
|
+
### How does this relate to SemVer?
|
|
162
|
+
|
|
163
|
+
`fix` type commits should be translated to `PATCH` releases. `feat` type commits should be translated to `MINOR` releases. Commits with `BREAKING CHANGE` in the commits, regardless of type, should be translated to `MAJOR` releases.
|
|
164
|
+
|
|
165
|
+
### How should I version my extensions to the Conventional Commits Specification, e.g. `@jameswomack/conventional-commit-spec`?
|
|
166
|
+
|
|
167
|
+
We recommend using SemVer to release your own extensions to this specification (and encourage you to make these extensions!)
|
|
168
|
+
|
|
169
|
+
### What do I do if I accidentally use the wrong commit type?
|
|
170
|
+
|
|
171
|
+
#### When you used a type that’s of the spec but not the correct type, e.g. `fix` instead of `feat`
|
|
172
|
+
|
|
173
|
+
Prior to merging or releasing the mistake, we recommend using `git rebase -i` to edit the commit history. After release, the cleanup will be different according to what tools and processes you use.
|
|
174
|
+
|
|
175
|
+
#### When you used a type _not_ of the spec, e.g. `feet` instead of `feat`
|
|
176
|
+
|
|
177
|
+
In a worst case scenario, it’s not the end of the world if a commit lands that does not meet the Conventional Commits specification. It simply means that commit will be missed by tools that are based on the spec.
|
|
178
|
+
|
|
179
|
+
### Do all my contributors need to use the Conventional Commits specification?
|
|
180
|
+
|
|
181
|
+
No! If you use a squash based workflow on Git lead maintainers can clean up the commit messages as they’re merged—adding no workload to casual committers. A common workflow for this is to have your git system automatically squash commits from a pull request and present a form for the lead maintainer to enter the proper git commit message for the merge.
|
|
182
|
+
|
|
183
|
+
### How does Conventional Commits handle revert commits?
|
|
184
|
+
|
|
185
|
+
Reverting code can be complicated: are you reverting multiple commits? if you revert a feature, should the next release instead be a patch?
|
|
186
|
+
|
|
187
|
+
Conventional Commits does not make an explicit effort to define revert behavior. Instead we leave it to tooling authors to use the flexibility of _types_ and _footers_ to develop their logic for handling reverts.
|
|
188
|
+
|
|
189
|
+
One recommendation is to use the `revert` type, and a footer that references the commit SHAs that are being reverted:
|
|
190
|
+
|
|
191
|
+
```
|
|
192
|
+
revert: let us never again speak of the noodle incident
|
|
193
|
+
|
|
194
|
+
Refs: 676104e, a215868
|
|
195
|
+
|
|
196
|
+
```
|
data/LICENSE.txt
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Dewayne VanHoozer
|
|
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
|
|
13
|
+
all 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
|
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
# htm-cli
|
|
2
|
+
|
|
3
|
+
The `htm` command line and MCP server for [HTM](https://github.com/madbomber/htm)
|
|
4
|
+
(Hierarchical Temporal Memory), the long-term memory library for LLM robots.
|
|
5
|
+
|
|
6
|
+
The memory itself is the `htm` gem. This gem is the application around it:
|
|
7
|
+
|
|
8
|
+
- `htm mcp` starts an MCP server on stdio, so Claude Desktop, Claude Code and
|
|
9
|
+
other MCP clients can remember and recall through HTM.
|
|
10
|
+
- `htm db`, `htm files`, `htm tags`, `htm entities`, `htm enrich`, `htm robots`
|
|
11
|
+
and `htm wm` set up and maintain an HTM database from the terminal.
|
|
12
|
+
- `htm remember`, `htm recall` and the other memory commands work on memory
|
|
13
|
+
directly.
|
|
14
|
+
|
|
15
|
+
Until HTM 0.2.0 these were part of the `htm` gem.
|
|
16
|
+
|
|
17
|
+
## Installation
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
gem install htm-cli
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
This installs the `htm` gem as a dependency. If an older `htm` (0.1.x) is
|
|
24
|
+
already installed, its `htm` command is in the way:
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
gem install htm-cli --force # replaces the htm command of the older htm
|
|
28
|
+
gem cleanup htm # removes the older htm versions
|
|
29
|
+
htm version # => htm-cli 0.2.0 (htm 0.2.0)
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
htm-cli and htm share a minor version: htm-cli 0.2.x runs against htm 0.2.x.
|
|
33
|
+
|
|
34
|
+
## Usage
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
htm help # every command
|
|
38
|
+
htm env # the environment variables that configure HTM
|
|
39
|
+
htm config # the default configuration, a starting point for --config FILE
|
|
40
|
+
htm db setup # create the schema in the configured database
|
|
41
|
+
htm mcp # start the MCP server
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
For an MCP client, for example Claude Desktop:
|
|
45
|
+
|
|
46
|
+
```json
|
|
47
|
+
{
|
|
48
|
+
"mcpServers": {
|
|
49
|
+
"htm-memory": {
|
|
50
|
+
"command": "htm",
|
|
51
|
+
"args": ["mcp"],
|
|
52
|
+
"env": { "HTM_DATABASE__URL": "postgresql://postgres@localhost:5432/htm_development" }
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
## Examples
|
|
59
|
+
|
|
60
|
+
`examples/` holds shell scripts that walk through the named-entity commands (`htm entities`, `recall --entity`, `timeline --entity`, merges, the entity curator) against a database of their own, `htmner_development`. Each prints the command it runs. See [examples/README.md](examples/README.md).
|
|
61
|
+
|
|
62
|
+
## Documentation
|
|
63
|
+
|
|
64
|
+
Every command, the MCP server's tools and resources, and an MCP client example are in [`docs/`](docs/index.md), a MkDocs site:
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
rake docs:serve # http://localhost:8000
|
|
68
|
+
rake docs:build # into site/, failing on any warning
|
|
69
|
+
rake docs:reference # rewrite each page's Command Reference
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
Each command page ends with a Command Reference written from the commands' own help: usage, description, options and examples. To change it, edit the command's `desc`, `long_desc` or options in `lib/htm/cli/`, or its examples in `rakelib/command_examples.yml`, then run `rake docs:reference`. The text above the reference on each page is written by hand.
|
|
73
|
+
|
|
74
|
+
`test/docs_coverage_test.rb` fails when a reference is out of date, a command has no example, an example uses an option its command does not have, or an MCP tool has no heading.
|
|
75
|
+
|
|
76
|
+
## Development
|
|
77
|
+
|
|
78
|
+
The code is three layers, all under the `HTM` namespace of the library:
|
|
79
|
+
|
|
80
|
+
| Layer | Path | What it is |
|
|
81
|
+
|-------|------|------------|
|
|
82
|
+
| `HTM::CLI` | `lib/htm/cli.rb`, `lib/htm/cli/` | the Thor command line |
|
|
83
|
+
| `HTM::MCP` | `lib/htm/mcp/` | the MCP server, its tools and resources |
|
|
84
|
+
| `HTM::Admin` | `lib/htm/admin.rb`, `lib/htm/admin/` | the commands behind both, writing to an `out` IO |
|
|
85
|
+
|
|
86
|
+
To work against a sibling checkout of htm (`../htm`) instead of the released gem:
|
|
87
|
+
|
|
88
|
+
```bash
|
|
89
|
+
BUNDLE_GEMFILE=Gemfile.local bundle install
|
|
90
|
+
BUNDLE_GEMFILE=Gemfile.local bundle exec rake test
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
The tests need PostgreSQL with pgvector and an `htm_test` database
|
|
94
|
+
(`HTM_ENV=test htm db create && HTM_ENV=test htm db setup`). `rake test` always
|
|
95
|
+
runs against `htm_test`, whatever database the shell points at.
|
|
96
|
+
|
|
97
|
+
## License
|
|
98
|
+
|
|
99
|
+
MIT. See [LICENSE.txt](LICENSE.txt).
|
data/Rakefile
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "bundler/gem_tasks"
|
|
4
|
+
require "minitest/test_task"
|
|
5
|
+
|
|
6
|
+
# The suite writes to the database, so it always runs against htm_test,
|
|
7
|
+
# never the database the shell points at.
|
|
8
|
+
#
|
|
9
|
+
# @return [Hash{String => String}] HTM_ENV and HTM_DATABASE__URL for the test database
|
|
10
|
+
#
|
|
11
|
+
def test_database_env(env = ENV)
|
|
12
|
+
service = env["HTM_SERVICE__NAME"] || "htm"
|
|
13
|
+
{ "HTM_ENV" => "test", "HTM_DATABASE__URL" => "postgresql://#{env.fetch('USER', nil)}@localhost:5432/#{service}_test" }
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
ENV.update(test_database_env)
|
|
17
|
+
|
|
18
|
+
Minitest::TestTask.create do |t|
|
|
19
|
+
t.test_globs = ["test/**/*_test.rb"]
|
|
20
|
+
t.warning = false
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
task default: :test
|
data/bin/htm
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
# frozen_string_literal: true
|
|
3
|
+
|
|
4
|
+
# The htm command line: `htm mcp` starts the MCP server, `htm help` lists
|
|
5
|
+
# the rest.
|
|
6
|
+
|
|
7
|
+
# Run from a checkout (the gem does not ship the Gemfile), use its bundle so
|
|
8
|
+
# gems resolve as Gemfile.lock pins them. Without it RubyGems activates the
|
|
9
|
+
# newest version of each gem, which can conflict (fast-mcp needs json ~> 2.0).
|
|
10
|
+
gemfile = File.expand_path("../Gemfile", __dir__)
|
|
11
|
+
if File.exist?(gemfile) && !defined?(Bundler)
|
|
12
|
+
ENV["BUNDLE_GEMFILE"] ||= gemfile
|
|
13
|
+
require "bundler/setup"
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
require_relative "../lib/htm/cli"
|
|
17
|
+
|
|
18
|
+
HTM::CLI.start(ARGV)
|