ai-first-os 2.1.0 → 2.1.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 +12 -8
- package/bin/ai-first-os.js +67 -8
- package/core/VERSION +1 -1
- package/core/lib/bootstrap.sh +9 -7
- package/core/lib/common.sh +69 -9
- package/core/lib/mount-repo.sh +5 -3
- package/core/lib/recall.sh +15 -4
- package/core/manual/COMO-FUNCIONA.md +13 -0
- package/core/manual/HOW-IT-WORKS.md +13 -0
- package/core/skills/bootstrap.md +18 -13
- package/core/skills/mount-repo.md +3 -2
- package/core/skills/recall.md +6 -0
- package/core/templates/strings.md +24 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -15,23 +15,27 @@ This document is written for your agent to execute, not for you to follow step b
|
|
|
15
15
|
|
|
16
16
|
## Requirements
|
|
17
17
|
|
|
18
|
-
**Installing the system takes
|
|
19
|
-
— an agent that installs first and reads the error afterwards leaves you with
|
|
20
|
-
instead of an answer.
|
|
18
|
+
**Installing the system takes one thing: git. Python 3 is recommended.** They are checked before
|
|
19
|
+
anything runs — an agent that installs first and reads the error afterwards leaves you with
|
|
20
|
+
`command not found` instead of an answer.
|
|
21
21
|
|
|
22
22
|
| What | When it is needed | How the agent checks it | Where it comes from if it is missing |
|
|
23
23
|
|---|---|---|---|
|
|
24
24
|
| git | To install the system | `git --version` | macOS: `xcode-select --install` · Windows: git-scm.com |
|
|
25
|
-
| python3 |
|
|
25
|
+
| python3 | Recommended, not required — without it the install goes on and warns that two features are missing: connecting a code repository (`mount-repo`) and Living Memory search (`recall`). It is found as `python3`, `python` or `py -3` | `python3 --version` (or `python --version`, or `py -3 --version`) | macOS: `xcode-select --install` (same command as git) · Windows: python.org · Linux: your distro's package manager |
|
|
26
26
|
| Node.js | Only for the `npx` install path and for the pack of skills offered at the end of the install — installing the system by git clone never needs it | `node --version` | The LTS installer at nodejs.org |
|
|
27
27
|
|
|
28
28
|
**The agent guides; you install.** System software is never installed by the agent on its own: it
|
|
29
29
|
points at the official channel, waits for you to run it, and checks again.
|
|
30
30
|
|
|
31
|
-
**git has no path around it
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
31
|
+
**git has no path around it.** Every brain is versioned from the moment it exists — that is what gives
|
|
32
|
+
you an auditable history and updates you can undo — so nothing gets written until git is there.
|
|
33
|
+
Install it and say "run bootstrap" again; nothing you already answered is lost.
|
|
34
|
+
|
|
35
|
+
**Python 3 does not stop the install.** Without it the system installs completely and warns, once,
|
|
36
|
+
that two features will not be available: connecting a code repository (`mount-repo`) and Living Memory
|
|
37
|
+
search (`recall`; the AI searches files as plain text instead). Install Python from python.org later
|
|
38
|
+
and they start working; nothing needs to be reinstalled.
|
|
35
39
|
|
|
36
40
|
**Node is not a requirement of the git-clone path below, and that path never runs `npx`.** Node
|
|
37
41
|
belongs to two optional things: installing with `npx ai-first-os` instead of cloning, and the pack of
|
package/bin/ai-first-os.js
CHANGED
|
@@ -4,8 +4,10 @@
|
|
|
4
4
|
// AI First OS launcher — this is what `npx ai-first-os` runs.
|
|
5
5
|
//
|
|
6
6
|
// It does three things, in this order, and nothing else:
|
|
7
|
-
// 1. checks git
|
|
8
|
-
// core/lib/bootstrap.sh
|
|
7
|
+
// 1. checks git is on PATH — the one hard requirement of the system, the same check
|
|
8
|
+
// core/lib/bootstrap.sh makes before writing anything. Python 3 is looked up by its three names
|
|
9
|
+
// (python3, python, py -3: the same order and the same test as os_python_find in
|
|
10
|
+
// core/lib/common.sh); without it the install goes on and prints a warning;
|
|
9
11
|
// 2. copies core/, README.md and LICENSE from this package to a fixed folder, ~/.ai-first-os,
|
|
10
12
|
// replacing whatever was already there — the npm cache this script runs from is reclaimed,
|
|
11
13
|
// so the system cannot keep living inside it;
|
|
@@ -31,6 +33,43 @@ function fail(message) {
|
|
|
31
33
|
process.exit(1);
|
|
32
34
|
}
|
|
33
35
|
|
|
36
|
+
// A candidate is accepted only if it runs and exits 0 exactly when its major version is 3. That
|
|
37
|
+
// leaves out the Microsoft Store shortcut (it fails) and a Python 2. Same order as os_python_find.
|
|
38
|
+
const PYTHON_PROBE = 'import sys; sys.exit(0 if sys.version_info[0] == 3 else 1)';
|
|
39
|
+
const PYTHON_CANDIDATES = [['python3'], ['python'], ['py', '-3']];
|
|
40
|
+
|
|
41
|
+
// Each probe has a deadline: a candidate that hangs counts as failed and the next one is tried.
|
|
42
|
+
const PROBE_TIMEOUT_MS = Number(process.env.AI_FIRST_OS_PROBE_TIMEOUT_MS) || 10000;
|
|
43
|
+
|
|
44
|
+
// Runs one probe of `argv` (command first). On Windows, a `.cmd` shim (pyenv-win and some managers)
|
|
45
|
+
// cannot be spawned directly: the spawn fails with ENOENT or EINVAL, and the probe is retried through
|
|
46
|
+
// `cmd.exe /d /s /c` with the line quoted. `.exe` candidates never reach that retry.
|
|
47
|
+
function runProbe(argv) {
|
|
48
|
+
const opts = { stdio: 'ignore', timeout: PROBE_TIMEOUT_MS };
|
|
49
|
+
let result = spawnSync(argv[0], argv.slice(1), opts);
|
|
50
|
+
if (result.error && process.platform === 'win32' && (result.error.code === 'ENOENT' || result.error.code === 'EINVAL')) {
|
|
51
|
+
const line = argv.map((a) => (/[\s"]/.test(a) ? '"' + a + '"' : a)).join(' ');
|
|
52
|
+
result = spawnSync(process.env.ComSpec || 'cmd.exe', ['/d', '/s', '/c', '"' + line + '"'], {
|
|
53
|
+
...opts,
|
|
54
|
+
windowsVerbatimArguments: true,
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
return !result.error && result.status === 0;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
function findPython() {
|
|
61
|
+
for (const candidate of PYTHON_CANDIDATES) {
|
|
62
|
+
if (runProbe(candidate.concat(['-c', PYTHON_PROBE]))) return candidate.join(' ');
|
|
63
|
+
}
|
|
64
|
+
return null;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
// Required by the evals (S080-C1) to run findPython alone; `npx` runs this file directly, never so.
|
|
68
|
+
if (require.main !== module) {
|
|
69
|
+
module.exports = { findPython };
|
|
70
|
+
return;
|
|
71
|
+
}
|
|
72
|
+
|
|
34
73
|
if (!hasCommand('git')) {
|
|
35
74
|
fail(
|
|
36
75
|
'git is missing. Install it from the official channel (macOS: `xcode-select --install`; ' +
|
|
@@ -38,12 +77,29 @@ if (!hasCommand('git')) {
|
|
|
38
77
|
);
|
|
39
78
|
}
|
|
40
79
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
80
|
+
// Printed in both languages, English first: the brain does not exist yet, so its language is unknown.
|
|
81
|
+
const PYTHON_WARNING =
|
|
82
|
+
"Python 3 was not found \u2014 installing anyway. Without Python, 2 features won't be available:\n" +
|
|
83
|
+
' \u2022 Connecting a code repository (mount-repo).\n' +
|
|
84
|
+
' \u2022 Living Memory search (recall). The AI searches files as plain text instead: it can\'t put the\n' +
|
|
85
|
+
' current version of a document above a replaced one, open the exact section, or follow what a\n' +
|
|
86
|
+
' document is about or what replaced it.\n' +
|
|
87
|
+
'To get them: install Python (python.org). Nothing needs to be reinstalled.\n' +
|
|
88
|
+
'\n' +
|
|
89
|
+
'No se encontr\u00f3 Python 3: la instalaci\u00f3n sigue. Sin Python hay 2 funcionalidades que no vas a tener disponibles:\n' +
|
|
90
|
+
' \u2022 Conectar un repositorio de c\u00f3digo (mount-repo).\n' +
|
|
91
|
+
' \u2022 La b\u00fasqueda de Living Memory (recall). La IA busca en los archivos como texto com\u00fan: no puede\n' +
|
|
92
|
+
' poner la versi\u00f3n vigente de un documento por encima de una reemplazada, abrir la secci\u00f3n exacta\n' +
|
|
93
|
+
' ni seguir de qu\u00e9 trata un documento o qu\u00e9 lo reemplaz\u00f3.\n' +
|
|
94
|
+
'Para tenerlas: instal\u00e1 Python (python.org). No hace falta reinstalar nada.\n';
|
|
95
|
+
|
|
96
|
+
// The marker means "the launcher already warned during this install": it is deleted at the start of
|
|
97
|
+
// every run and written only when this run warns. A retry of the launcher warns again.
|
|
98
|
+
const warnedMarker = path.join(os.homedir(), '.ai-first-os', '.python-warned');
|
|
99
|
+
fs.rmSync(warnedMarker, { force: true });
|
|
100
|
+
const pythonFound = findPython() !== null;
|
|
101
|
+
if (!pythonFound) {
|
|
102
|
+
process.stderr.write(PYTHON_WARNING);
|
|
47
103
|
}
|
|
48
104
|
|
|
49
105
|
const packageRoot = path.join(__dirname, '..');
|
|
@@ -61,6 +117,8 @@ copyReplace('core');
|
|
|
61
117
|
copyReplace('README.md');
|
|
62
118
|
copyReplace('LICENSE');
|
|
63
119
|
|
|
120
|
+
if (!pythonFound) fs.writeFileSync(warnedMarker, 'The launcher warned that Python 3 was not found.\n');
|
|
121
|
+
|
|
64
122
|
const LOGO = [
|
|
65
123
|
' █████╗ ██╗ ███████╗██╗██████╗ ███████╗████████╗ ██████╗ ███████╗',
|
|
66
124
|
'██╔══██╗██║ ██╔════╝██║██╔══██╗██╔════╝╚══██╔══╝ ██╔═══██╗██╔════╝',
|
|
@@ -185,3 +243,4 @@ printLogo().then(() => {
|
|
|
185
243
|
);
|
|
186
244
|
process.stdout.write('Tell your agent: read and follow ' + bootstrapPath + '\n');
|
|
187
245
|
});
|
|
246
|
+
|
package/core/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
2.1.
|
|
1
|
+
2.1.1
|
package/core/lib/bootstrap.sh
CHANGED
|
@@ -62,13 +62,6 @@ done
|
|
|
62
62
|
command -v git > /dev/null 2>&1 \
|
|
63
63
|
|| os_die "falta git: instalalo desde el canal oficial (macOS: correr \`xcode-select --install\`; Windows: bajarlo de git-scm.com — lo instala el operador, nunca el agente) y volvé a correr este mismo comando — el bootstrap no escribió nada"
|
|
64
64
|
|
|
65
|
-
# python3 es requisito duro junto a git (spec 030): mount-repo lo necesita para autorizar el
|
|
66
|
-
# checkout que monta. Mismo patrón y mismo momento que el chequeo de git — la segunda verificación,
|
|
67
|
-
# todavía antes de crear ningún archivo. Con git ausente el mensaje de arriba ya frenó, así que este
|
|
68
|
-
# chequeo solo se alcanza con git presente.
|
|
69
|
-
command -v python3 > /dev/null 2>&1 \
|
|
70
|
-
|| os_die "falta python3: instalalo desde el canal oficial (macOS: correr \`xcode-select --install\`, el mismo comando que trae git; Windows: bajarlo de python.org; Linux: el gestor de paquetes de la distro) y volvé a correr este mismo comando — el bootstrap no escribió nada"
|
|
71
|
-
|
|
72
65
|
name=""
|
|
73
66
|
language=""
|
|
74
67
|
profile=""
|
|
@@ -183,6 +176,15 @@ elif ! os_language_valido "$language"; then
|
|
|
183
176
|
fi
|
|
184
177
|
os_lang_load "$language"
|
|
185
178
|
|
|
179
|
+
# Python 3 es recomendado, no obligatorio (spec 080; reemplaza el requisito duro de la spec 030). Se
|
|
180
|
+
# busca por sus tres nombres (`os_python_find`). Sin él el cerebro nace completo y el aviso dice, en el
|
|
181
|
+
# idioma del cerebro, qué dos funcionalidades no van a estar. La persona lo ve una sola vez por
|
|
182
|
+
# instalación: si el lanzador `npx` ya lo imprimió (antes de que existiera un cerebro, en los dos
|
|
183
|
+
# idiomas) dejó `.python-warned` en la raíz del producto instalado, y acá no se repite.
|
|
184
|
+
if ! os_python_find && [ ! -f "$here/../../.python-warned" ]; then
|
|
185
|
+
printf '%s\n' "$S_PYTHON_MISSING_WARNING" >&2
|
|
186
|
+
fi
|
|
187
|
+
|
|
186
188
|
templates="$here/../templates"
|
|
187
189
|
mkdir -p "$brain"
|
|
188
190
|
# Ruta física: `git rev-parse --show-toplevel` la devuelve resuelta, y comparar contra una ruta con
|
package/core/lib/common.sh
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
#!/usr/bin/env bash
|
|
2
2
|
# Funciones compartidas por los comandos de core/. Interno: no es invocable.
|
|
3
|
-
# Bash 3.2 en adelante. Sin dependencias fuera de bash + coreutils, con una excepción:
|
|
4
|
-
# —
|
|
5
|
-
#
|
|
3
|
+
# Bash 3.2 en adelante. Sin dependencias fuera de bash + coreutils, con una excepción: Python 3 (python3)
|
|
4
|
+
# —recomendado, no obligatorio desde la spec 080— lo usan `os_settings_authorize`, `mount-repo.sh` y
|
|
5
|
+
# `recall.sh`. Se busca con `os_python_find`, por sus tres nombres.
|
|
6
6
|
|
|
7
7
|
# Tope de identidad, en líneas. Única enunciación del número en el código distribuido.
|
|
8
8
|
OS_IDENTITY_CAP=40
|
|
@@ -2221,9 +2221,61 @@ os_gitignore_ensure() {
|
|
|
2221
2221
|
return 0
|
|
2222
2222
|
}
|
|
2223
2223
|
|
|
2224
|
-
#
|
|
2225
|
-
#
|
|
2226
|
-
#
|
|
2224
|
+
# Python 3 por sus tres nombres (spec 080). Única enunciación del orden y de la prueba en bash;
|
|
2225
|
+
# `findPython` de ai-first-os.js (el lanzador de npx) la espeja. Orden: `python3`, `python`, `py -3` (el lanzador de Windows,
|
|
2226
|
+
# que deja `py` y `python` pero nunca `python3`). Un candidato se acepta solo si corre de verdad y
|
|
2227
|
+
# termina con éxito únicamente cuando su versión mayor es 3: así quedan afuera el atajo de la
|
|
2228
|
+
# Microsoft Store (falla) y un Python 2.
|
|
2229
|
+
# El comando queda en el arreglo `OS_PY` —una palabra o dos (`py -3`)—, y se corre siempre como
|
|
2230
|
+
# "${OS_PY[@]}" o con `os_py`, sin depender de que una cadena se parta en espacios.
|
|
2231
|
+
OS_PY=()
|
|
2232
|
+
OS_PYTHON_PROBE='import sys; sys.exit(0 if sys.version_info[0] == 3 else 1)'
|
|
2233
|
+
|
|
2234
|
+
# os_python_probe CMD... -> 0 si CMD (una o dos palabras) corre y es Python 3. Con `perl` en el PATH la
|
|
2235
|
+
# prueba tiene un plazo (OS_PYTHON_PROBE_TIMEOUT, 10 s por defecto): un candidato colgado cuenta como
|
|
2236
|
+
# fallo y se pasa al siguiente. Sin `perl` no hay plazo.
|
|
2237
|
+
os_python_probe() {
|
|
2238
|
+
if command -v perl > /dev/null 2>&1; then
|
|
2239
|
+
perl -e 'alarm shift; exec @ARGV' "${OS_PYTHON_PROBE_TIMEOUT:-10}" "$@" -c "$OS_PYTHON_PROBE" > /dev/null 2>&1
|
|
2240
|
+
else
|
|
2241
|
+
"$@" -c "$OS_PYTHON_PROBE" > /dev/null 2>&1
|
|
2242
|
+
fi
|
|
2243
|
+
}
|
|
2244
|
+
|
|
2245
|
+
# os_python_find -> 0 y deja el comando en OS_PY; 1 y deja OS_PY vacío si ningún nombre sirve.
|
|
2246
|
+
os_python_find() {
|
|
2247
|
+
OS_PY=()
|
|
2248
|
+
if command -v python3 > /dev/null 2>&1 && os_python_probe python3; then
|
|
2249
|
+
OS_PY=(python3); return 0
|
|
2250
|
+
fi
|
|
2251
|
+
if command -v python > /dev/null 2>&1 && os_python_probe python; then
|
|
2252
|
+
OS_PY=(python); return 0
|
|
2253
|
+
fi
|
|
2254
|
+
if command -v py > /dev/null 2>&1 && os_python_probe py -3; then
|
|
2255
|
+
OS_PY=(py -3); return 0
|
|
2256
|
+
fi
|
|
2257
|
+
return 1
|
|
2258
|
+
}
|
|
2259
|
+
|
|
2260
|
+
# os_python_cmd -> imprime el comando de Python 3 (`python3`, `python` o `py -3`); sin Python 3 no
|
|
2261
|
+
# imprime nada y sale 1. Para mostrarlo y para los evals; para correrlo, `os_py`.
|
|
2262
|
+
os_python_cmd() {
|
|
2263
|
+
( os_python_find && printf '%s' "${OS_PY[*]}" )
|
|
2264
|
+
}
|
|
2265
|
+
|
|
2266
|
+
# os_py ARGS... -> corre Python 3 con ARGS (stdin y stdout pasan tal cual). Sale 127 sin escribir
|
|
2267
|
+
# nada si no hay Python 3. Busca una vez por proceso. Fuerza UTF-8 en la entrada y la salida: el Python
|
|
2268
|
+
# nativo de Windows usa la página de códigos ANSI en los pipes, que corrompe nombres de archivo con
|
|
2269
|
+
# tildes y rompe con `→` o emoji.
|
|
2270
|
+
os_py() {
|
|
2271
|
+
if [ "${#OS_PY[@]}" -eq 0 ]; then
|
|
2272
|
+
os_python_find || return 127
|
|
2273
|
+
fi
|
|
2274
|
+
PYTHONIOENCODING=utf-8 PYTHONUTF8=1 "${OS_PY[@]}" "$@"
|
|
2275
|
+
}
|
|
2276
|
+
|
|
2277
|
+
# El nombre del archivo de permisos del harness, relativo al brain (spec 030). Python 3 lo lee y
|
|
2278
|
+
# escribe (`os_py`); `mount-repo.sh` lo busca antes de escribir y frena sin él (spec 080).
|
|
2227
2279
|
OS_SETTINGS_ARCHIVO=".claude/settings.local.json"
|
|
2228
2280
|
|
|
2229
2281
|
# os_settings_authorize BRAIN RUTA
|
|
@@ -2235,11 +2287,12 @@ OS_SETTINGS_ARCHIVO=".claude/settings.local.json"
|
|
|
2235
2287
|
# 0 la agregó (el archivo pudo nacer o ya existir)
|
|
2236
2288
|
# 1 ya estaba
|
|
2237
2289
|
# 2 el archivo existe y no es JSON válido — no se tocó
|
|
2290
|
+
# 9 Python falló por otra razón (una excepción, no haber Python): nada se puede dar por autorizado
|
|
2238
2291
|
os_settings_authorize() {
|
|
2239
2292
|
local brain="$1" ruta="$2" archivo
|
|
2240
2293
|
archivo="$brain/$OS_SETTINGS_ARCHIVO"
|
|
2241
2294
|
mkdir -p "$(dirname "$archivo")" 2>/dev/null
|
|
2242
|
-
|
|
2295
|
+
os_py - "$archivo" "$ruta" <<'PY'
|
|
2243
2296
|
import json
|
|
2244
2297
|
import os
|
|
2245
2298
|
import sys
|
|
@@ -2264,7 +2317,7 @@ directorios = permisos.setdefault("additionalDirectories", [])
|
|
|
2264
2317
|
if not isinstance(directorios, list):
|
|
2265
2318
|
sys.exit(2)
|
|
2266
2319
|
if ruta in directorios:
|
|
2267
|
-
sys.exit(
|
|
2320
|
+
sys.exit(10)
|
|
2268
2321
|
directorios.append(ruta)
|
|
2269
2322
|
|
|
2270
2323
|
with open(archivo, "w", encoding="utf-8") as f:
|
|
@@ -2272,7 +2325,14 @@ with open(archivo, "w", encoding="utf-8") as f:
|
|
|
2272
2325
|
f.write("\n")
|
|
2273
2326
|
sys.exit(0)
|
|
2274
2327
|
PY
|
|
2275
|
-
|
|
2328
|
+
local rc=$?
|
|
2329
|
+
# Dentro de Python, 10 es «ya estaba»: un `exit 1` es el de una excepción sin atrapar, y no puede
|
|
2330
|
+
# leerse como «ya autorizado».
|
|
2331
|
+
case "$rc" in
|
|
2332
|
+
0|2) return "$rc" ;;
|
|
2333
|
+
10) return 1 ;;
|
|
2334
|
+
*) return 9 ;;
|
|
2335
|
+
esac
|
|
2276
2336
|
}
|
|
2277
2337
|
|
|
2278
2338
|
# os_now_ms -> milisegundos desde epoch.
|
package/core/lib/mount-repo.sh
CHANGED
|
@@ -32,9 +32,10 @@
|
|
|
32
32
|
#
|
|
33
33
|
# Exit: 0 montó o ya estaba · 2 argumentos o cabeza inválidos · 3 el remote no responde
|
|
34
34
|
# 4 la cabeza ya declara otro `repo:` · 5 la raíz de clonado falta o es inválida
|
|
35
|
-
# 6 falta `python3`
|
|
35
|
+
# 6 falta Python 3 —buscado como `python3`, `python` o `py -3`, spec 080—, necesario para autorizar el checkout (spec 030)
|
|
36
36
|
# 7 `--new` on a remote that does answer: there is nothing to create (spec 034)
|
|
37
37
|
# 8 `--new`: the birth of the repo failed — the message names why (spec 034)
|
|
38
|
+
# 9 Python 3 was found but the authorization of the checkout failed (spec 080): not an «already authorized»
|
|
38
39
|
#
|
|
39
40
|
# Nada se escribe antes de que las seis validaciones pasen —siete con `--new`, que suma la del
|
|
40
41
|
# destino—: una negativa a mitad de camino deja el nodo montado a medias, que es peor que no
|
|
@@ -106,7 +107,7 @@ remote_github_slug() {
|
|
|
106
107
|
printf '%s/%s' "$owner" "$name"
|
|
107
108
|
}
|
|
108
109
|
|
|
109
|
-
#
|
|
110
|
+
# Python 3 es necesario acá (spec 030, buscado por sus tres nombres desde la spec 080): el cuarto acto —autorizar el
|
|
110
111
|
# checkout para el harness— lo necesita para leer y escribir el JSON de settings.local.json. Se
|
|
111
112
|
# chequea antes de la primera escritura, con el mismo criterio que el resto de las validaciones.
|
|
112
113
|
# The language of what gets written is the brain's, declared once in `operator.md` (spec 021), and
|
|
@@ -115,7 +116,7 @@ remote_github_slug() {
|
|
|
115
116
|
language=$(os_language "$brain")
|
|
116
117
|
os_lang_load "$language"
|
|
117
118
|
|
|
118
|
-
|
|
119
|
+
os_python_find || {
|
|
119
120
|
printf '%s\n' "$S_MOUNT_NO_PYTHON3" >&2
|
|
120
121
|
printf '%s\n' "$S_MOUNT_NOTHING_WRITTEN" >&2
|
|
121
122
|
exit 6
|
|
@@ -498,6 +499,7 @@ case "$?" in
|
|
|
498
499
|
0) printf "$S_MOUNT_SETTINGS_ADDED\n" "$OS_SETTINGS_ARCHIVO" "$destino" ;;
|
|
499
500
|
1) printf "$S_MOUNT_SETTINGS_ALREADY\n" "$OS_SETTINGS_ARCHIVO" ;;
|
|
500
501
|
2) printf "$S_MOUNT_SETTINGS_INVALID\n" "$OS_SETTINGS_ARCHIVO" "$brain/$OS_SETTINGS_ARCHIVO" ;;
|
|
502
|
+
*) printf '%s\n' "$S_MOUNT_SETTINGS_FAILED" >&2; exit 9 ;;
|
|
501
503
|
esac
|
|
502
504
|
|
|
503
505
|
# La tabla no viaja: la frontera es el gitignore del brain, y la escribe el comando que crea el
|
package/core/lib/recall.sh
CHANGED
|
@@ -11,8 +11,9 @@
|
|
|
11
11
|
# WHAT THIS COMMAND INDEXES. The index is `.os/living-memory.sqlite`, inside the brain: never
|
|
12
12
|
# committed (`.os/` is already in every brain's `.gitignore`, `os_gitignore_ensure`), and it is
|
|
13
13
|
# derived and discardable — deleting it just costs the next call a full reindex. It is written with
|
|
14
|
-
# `python3
|
|
15
|
-
#
|
|
14
|
+
# Python 3 (found by `os_python_find`: python3, python or py -3) and the `sqlite3` module of the
|
|
15
|
+
# standard library, using an FTS5 table: no dependency the product does not already carry (Python 3
|
|
16
|
+
# is recommended since spec 080, and the sqlite3
|
|
16
17
|
# that ships with the official installers of macOS, Windows and Linux carries FTS5).
|
|
17
18
|
#
|
|
18
19
|
# THE FILE LIST HAS ONE READER. `tree.md` has two classes of line since spec 007, and the only
|
|
@@ -54,7 +55,8 @@
|
|
|
54
55
|
#
|
|
55
56
|
# Exit: 0 the search or the expansion ran, with or without results/neighbours. 1 invalid arguments
|
|
56
57
|
# (missing/contradictory flags, no scope named). 2 the named workspace does not exist (same keys as
|
|
57
|
-
# `session-start.sh`).
|
|
58
|
+
# `session-start.sh`). 3 Python 3 is not available under any of its names (spec 080); 1 stays for a
|
|
59
|
+
# Python that is there and an index that failed.
|
|
58
60
|
#
|
|
59
61
|
# No `set -e`: a query with no results is not a failure.
|
|
60
62
|
|
|
@@ -215,9 +217,18 @@ stdin_data="$true_heads
|
|
|
215
217
|
%%FILES%%
|
|
216
218
|
$all_files"
|
|
217
219
|
|
|
218
|
-
|
|
220
|
+
# Python 3 se busca por sus tres nombres (spec 080). Sin él, un mensaje del catálogo y el código 3:
|
|
221
|
+
# distinto del 1, que sigue siendo "hay Python 3 y el índice falló".
|
|
222
|
+
os_python_find || {
|
|
223
|
+
printf '%s\n' "$S_RECALL_NO_PYTHON" >&2
|
|
224
|
+
exit 3
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
result=$(printf '%s\n' "$stdin_data" | os_py -B "$here/recall_index.py" \
|
|
219
228
|
"$db" "$brain" "$mode" "$scope_kind" "$wsdir" "$scope_slug" "$arg" "$limit")
|
|
220
229
|
rc=$?
|
|
230
|
+
# El Python de Windows termina las líneas con CRLF: sin sacar el \r, `grep -qx` no reconoce el centinela.
|
|
231
|
+
result=${result//$'\r'/}
|
|
221
232
|
if [ "$rc" != "0" ]; then
|
|
222
233
|
printf 'error: recall.sh could not run its index (python3/sqlite3)\n' >&2
|
|
223
234
|
exit 1
|
|
@@ -244,6 +244,19 @@ Cualquier skill que escribas vos va al lado, como carpeta común en `.claude/ski
|
|
|
244
244
|
> manual apunta ahí en vez de contarlo de nuevo, porque dos versiones del mismo procedimiento se
|
|
245
245
|
> separan.
|
|
246
246
|
|
|
247
|
+
## 🧰 Requisitos
|
|
248
|
+
|
|
249
|
+
**`git` es obligatorio; Python 3 es recomendado.** El sistema se instala sin Python y lo avisa cuando
|
|
250
|
+
pasa. Sin Python 3 hay dos cosas que no funcionan:
|
|
251
|
+
|
|
252
|
+
- **Conectar un repositorio de código** (`mount-repo`).
|
|
253
|
+
- **La búsqueda de Living Memory** (`recall`). La IA busca en los archivos como texto común: no puede
|
|
254
|
+
poner la versión vigente de un documento por encima de una reemplazada, abrir la sección exacta ni
|
|
255
|
+
seguir de qué trata un documento o qué lo reemplazó.
|
|
256
|
+
|
|
257
|
+
Para tenerlas, instalá Python desde python.org: el sistema lo encuentra como `python3`, `python` o
|
|
258
|
+
`py -3`. No hace falta reinstalar nada.
|
|
259
|
+
|
|
247
260
|
## 💬 Qué podés pedir, y cómo
|
|
248
261
|
|
|
249
262
|
**El índice es el resolver, no tu memoria.** Pedís con tus palabras —"qué hay pendiente", "cerrá la
|
|
@@ -233,6 +233,19 @@ them, as a plain folder in `.claude/skills/`.
|
|
|
233
233
|
> written once, in the `README.md` of the product's folder under **Update**; this manual points at
|
|
234
234
|
> it instead of telling it again, because two versions of the same procedure drift apart.
|
|
235
235
|
|
|
236
|
+
## 🧰 Requirements
|
|
237
|
+
|
|
238
|
+
**`git` is required; Python 3 is recommended.** The system installs without Python and says so when it
|
|
239
|
+
does. Without Python 3, two things do not work:
|
|
240
|
+
|
|
241
|
+
- **Connecting a code repository** (`mount-repo`).
|
|
242
|
+
- **Living Memory search** (`recall`). The AI searches the files as plain text instead: it cannot put
|
|
243
|
+
the current version of a document above a replaced one, open the exact section, or follow what a
|
|
244
|
+
document is about or what replaced it.
|
|
245
|
+
|
|
246
|
+
To get them, install Python from python.org: the system finds it as `python3`, `python` or `py -3`.
|
|
247
|
+
Nothing needs to be reinstalled.
|
|
248
|
+
|
|
236
249
|
## 💬 What you can ask for, and how
|
|
237
250
|
|
|
238
251
|
**The index is the resolver, not your memory.** You ask in your own words —"what is pending", "close
|
package/core/skills/bootstrap.md
CHANGED
|
@@ -20,27 +20,32 @@ what is missing:
|
|
|
20
20
|
|
|
21
21
|
```
|
|
22
22
|
git --version
|
|
23
|
-
python3 --version
|
|
23
|
+
python3 --version # or `python --version`, or `py -3 --version` on Windows
|
|
24
24
|
```
|
|
25
25
|
|
|
26
26
|
- **git missing**: macOS, `xcode-select --install`; Windows, git-scm.com.
|
|
27
|
-
- **
|
|
28
|
-
|
|
27
|
+
- **Python 3 missing** (under all of `python3`, `python` and `py -3`): python.org; macOS,
|
|
28
|
+
`xcode-select --install` — the same command that brings git; Linux, the distro's package manager.
|
|
29
|
+
It is recommended, not required: the install goes on without it.
|
|
29
30
|
|
|
30
|
-
**You guide; the operator installs.** You never install system software on your own
|
|
31
|
-
official channel, wait for them to run it, and check again.
|
|
31
|
+
**You guide; the operator installs.** You never install system software on your own. For **git**, you
|
|
32
|
+
name the official channel, wait for them to run it, and check again. For Python you wait for nothing
|
|
33
|
+
(see below). Anything they decline is a choice, not
|
|
32
34
|
an error: report it and take the branch below that matches.
|
|
33
35
|
|
|
34
|
-
**git has no path around it
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
36
|
+
**git has no path around it: there is no alternative branch for it.** If it is missing, stop right
|
|
37
|
+
there — point at the install channel, wait for the operator to run it, check again. `bootstrap.sh`
|
|
38
|
+
itself refuses to write anything without git, and re-running the same command once it is installed
|
|
39
|
+
picks the interview up cleanly.
|
|
40
|
+
|
|
41
|
+
**Python 3 does not stop the install (spec 080).** Without it `bootstrap.sh` prints a warning in the
|
|
42
|
+
brain's language and creates the full brain. Tell the operator the two things it costs: connecting a
|
|
43
|
+
code repository (`mount-repo`) and Living Memory search (`recall`; the AI searches files as plain
|
|
44
|
+
text instead). Then continue straight to the interview: do not ask them to install Python first, do not
|
|
45
|
+
wait for it, do not re-check it. Installing Python later needs no reinstall.
|
|
41
46
|
|
|
42
47
|
**Nothing else is checked here, and Node is not checked here on purpose.** Installing the system
|
|
43
|
-
needs git and
|
|
48
|
+
needs git and nothing more: no `npx`, no download from a registry, no npm prompt in the
|
|
44
49
|
middle of an install that has not written a single file yet. Node is the requirement of one later
|
|
45
50
|
step —the pack, offered at the close of this bootstrap— and it gets checked there, when it is the
|
|
46
51
|
thing being done.
|
|
@@ -83,11 +83,12 @@ Running it twice on the same remote neither duplicates the row nor clones again.
|
|
|
83
83
|
| 3 | The remote does not answer | Check the remote and the permissions; if the repo does not exist yet, `--new` |
|
|
84
84
|
| 4 | The head already declares **another** `repo:` | It belongs to the operator: ask which one stays |
|
|
85
85
|
| 5 | The clone root is missing, or falls inside the brain or inside another repo; with `--new`, the destination is taken by something that is not this remote's repo, or `mounts.md` points this remote outside the clone root | Ask where the checkouts go; a destination or a row that is already there belongs to the operator |
|
|
86
|
-
| 6 |
|
|
86
|
+
| 6 | Python 3 is missing under all of its names (`python3`, `python`, `py -3`) — mounting needs it to authorize the checkout | Install it (python.org; macOS: `xcode-select --install`, the same command that brings git; Linux: the distro's package manager) and re-run |
|
|
87
87
|
| 7 | `--new` on a remote that **does** answer | There is nothing to create: mount it without `--new` |
|
|
88
88
|
| 8 | `--new`: the birth failed — the message names why | What the command had created gets removed, or it says what was left behind; fix what the message names and run it again |
|
|
89
|
+
| 9 | Python 3 was found but failed while authorizing the checkout (it is not read as «already authorized») | Fix Python (the message says so) and re-run the same command: the mount resumes |
|
|
89
90
|
|
|
90
|
-
In
|
|
91
|
+
In exits 2 to 8 nothing was written; exit 9 comes after the clone and the table, and re-running resumes it. A half-mounted node is worse than an unmounted one.
|
|
91
92
|
|
|
92
93
|
## When it finishes
|
|
93
94
|
|
package/core/skills/recall.md
CHANGED
|
@@ -57,6 +57,12 @@ Prints the head this file's `about:` names, the files whose `about:` names this
|
|
|
57
57
|
one's `superseded_by:` names, and the files whose `superseded_by:` names this one — one line each,
|
|
58
58
|
`<relation> · <path> · <title>`. One jump: what a neighbour itself declares is never followed.
|
|
59
59
|
|
|
60
|
+
## Exit codes
|
|
61
|
+
|
|
62
|
+
`0` ran, with or without results. `1` bad arguments, or Python 3 is there and the index failed. `2` the
|
|
63
|
+
named workspace does not exist. `3` Python 3 is not on this computer (not as `python3`, `python` or
|
|
64
|
+
`py -3`): the command says so and the session searches with `grep` instead.
|
|
65
|
+
|
|
60
66
|
## What it does not do
|
|
61
67
|
|
|
62
68
|
It does not read meaning across two matches, and it does not follow a chain of more than one jump.
|
|
@@ -603,8 +603,30 @@ en: nothing was written.
|
|
|
603
603
|
es: no se escribió nada.
|
|
604
604
|
|
|
605
605
|
key: MOUNT_NO_PYTHON3
|
|
606
|
-
en:
|
|
607
|
-
es: falta
|
|
606
|
+
en: Python 3 is missing: install it from python.org (macOS: run `xcode-select --install`, the same command that brings git; Linux: your distro's package manager) and run this same command again. It is searched as python3, python or py -3.
|
|
607
|
+
es: falta Python 3: instalalo desde python.org (macOS: correr `xcode-select --install`, el mismo comando que trae git; Linux: el gestor de paquetes de la distro) y volvé a correr este mismo comando. Se busca como python3, python o py -3.
|
|
608
|
+
|
|
609
|
+
key: PYTHON_MISSING_WARNING
|
|
610
|
+
en: Python 3 was not found — installing anyway. Without Python, 2 features won't be available:
|
|
611
|
+
es: No se encontró Python 3: la instalación sigue. Sin Python hay 2 funcionalidades que no vas a tener disponibles:
|
|
612
|
+
en: • Connecting a code repository (mount-repo).
|
|
613
|
+
es: • Conectar un repositorio de código (mount-repo).
|
|
614
|
+
en: • Living Memory search (recall). The AI searches files as plain text instead: it can't put the
|
|
615
|
+
es: • La búsqueda de Living Memory (recall). La IA busca en los archivos como texto común: no puede
|
|
616
|
+
en: current version of a document above a replaced one, open the exact section, or follow what a
|
|
617
|
+
es: poner la versión vigente de un documento por encima de una reemplazada, abrir la sección exacta
|
|
618
|
+
en: document is about or what replaced it.
|
|
619
|
+
es: ni seguir de qué trata un documento o qué lo reemplazó.
|
|
620
|
+
en: To get them: install Python (python.org). Nothing needs to be reinstalled.
|
|
621
|
+
es: Para tenerlas: instalá Python (python.org). No hace falta reinstalar nada.
|
|
622
|
+
|
|
623
|
+
key: RECALL_NO_PYTHON
|
|
624
|
+
en: recall needs Python 3, which is not available on this computer. Search the brain with grep instead.
|
|
625
|
+
es: recall necesita Python 3, que no está en esta computadora. Buscá en el cerebro con grep.
|
|
626
|
+
|
|
627
|
+
key: MOUNT_SETTINGS_FAILED
|
|
628
|
+
en: Python 3 failed while authorizing the checkout for the agent: the mount is incomplete. Fix Python and run this same command again.
|
|
629
|
+
es: Python 3 falló al autorizar el checkout para el agente: el montaje quedó incompleto. Arreglá Python y volvé a correr este mismo comando.
|
|
608
630
|
|
|
609
631
|
key: MOUNT_HEAD_ABSOLUTE
|
|
610
632
|
en: the head is named relative to the brain: %s
|
package/package.json
CHANGED