[OCaml] High Intensity Training Online
docs Separate tool location from project root for global install
Rework the install section so the skill works from a shared global directory, not only from a project's own .kiro/skills tree. - Load the tool file from wherever it is installed, and set rail-project-root to the project you work in. These are two separate places: the tool file has one fixed home, the project root changes per project. - Add a verification step that prints the resolved stream file path, so a global install can confirm it points at the right project. The earlier snippet derived the project root from the tool file path, which only held when the tool file sat inside the project.
.kiro/skills/rail/SKILL.md
@@ -112,30 +112,35 @@
112
112
113
113
## Install the tools once per session
114
114
115
Removed:
The tools live in `rail-tools.el`, beside this file. Load that file one
116
Removed:
time in the running Emacs. Use the generic `eval-elisp` tool for the load
117
Removed:
only.
115
Added:
The tools live in `rail-tools.el`, beside this `SKILL.md`. The skill can
116
Added:
sit in one project, or in a shared global directory that serves every
117
Added:
project. Load the tool file one time in the running Emacs. Use the
118
Added:
generic `eval-elisp` tool for the load only.
118
119
119
Removed:
Pass the project directory of your own session in `project`. Do not write
120
Removed:
an absolute path from a home directory into the form, because that path
121
Removed:
differs on every machine.
120
Added:
Load the tool file from the directory of this `SKILL.md`, and pass the
121
Added:
directory of the project you work in as the project root. These are two
122
Added:
separate places. The tool file has one fixed home. The project root
123
Added:
changes with each project.
122
124
123
125
```elisp
124
Removed:
(let* ((project "/the/project/directory/you/work/in")
125
Removed:
(tools (expand-file-name ".kiro/skills/rail/rail-tools.el"
126
Removed:
project)))
126
Added:
(let ((tools "/absolute/path/to/this/skill/rail-tools.el")
127
Added:
(project "/the/project/directory/you/work/in"))
127
128
(unless (file-readable-p tools)
128
129
(error "No RAIL tools at %s" tools))
129
Removed:
(load tools nil t))
130
Added:
(load tools nil t)
131
Added:
(setq rail-project-root (file-name-as-directory project)))
130
132
```
131
133
132
Removed:
The tool file then finds the project root itself. It searches upward from
133
Removed:
its own directory for `RAIL.org`. The search assumes no directory layout,
134
Removed:
so the same file works on every machine. The result becomes
135
Removed:
`rail-project-root`, and every tool uses it by default.
134
Added:
Set `rail-project-root` to the project you work in. Every tool then uses
135
Added:
that project by default, wherever the tool file itself lives. Do not
136
Added:
write an absolute path from a home directory as a fixed constant in a
137
Added:
committed file, because that path differs on every machine.
136
138
137
Removed:
Do not depend on the Emacs `default-directory`. That directory often sits
138
Removed:
outside the project, and the search then finds no stream file.
139
Added:
The tool file also runs an upward search for `RAIL.org` at load time, from
140
Added:
its own directory and then from `default-directory`. That search finds the
141
Added:
project only when the tool file sits inside the project. For a shared
142
Added:
install, or when `default-directory` sits outside the project, set
143
Added:
`rail-project-root` as shown, or pass `root` to each tool call.
139
144
140
145
Then verify that the tools are present. This expression returns the
141
146
thirteen tool names:
@@ -143,6 +148,16 @@
143
148
```elisp
144
149
(seq-filter (lambda (name) (string-prefix-p "rail-" name))
145
150
(mcp-server-tools-list-names))
151
Added:
```
152
Added:
153
Added:
Confirm that the tools resolve the right project. This expression returns
154
Added:
the stream file path:
155
Added:
156
Added:
```elisp
157
Added:
(alist-get 'file (json-parse-string
158
Added:
(alist-get 'text (aref (mcp-server-tools-call
159
Added:
"rail-inspect" nil) 0))
160
Added:
:object-type 'alist))
146
161
```
147
162
148
163
If the load fails, stop and report the problem. Do not edit `RAIL.org` as