ai-first-os 1.9.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 +21 -0
- package/README.md +226 -0
- package/bin/ai-first-os.js +72 -0
- package/core/CLAUDE.md +148 -0
- package/core/VERSION +1 -0
- package/core/agents/ambiguous-spec.md +39 -0
- package/core/agents/complete-spec.md +36 -0
- package/core/agents/scout.md +25 -0
- package/core/install.sh +243 -0
- package/core/lib/archive.sh +347 -0
- package/core/lib/bootstrap.sh +276 -0
- package/core/lib/capture.sh +188 -0
- package/core/lib/check-resolvable.sh +172 -0
- package/core/lib/close-session.sh +741 -0
- package/core/lib/common.sh +1773 -0
- package/core/lib/focus-read.sh +282 -0
- package/core/lib/manual-link.sh +111 -0
- package/core/lib/markdown.py +304 -0
- package/core/lib/migrate-backlogs.sh +207 -0
- package/core/lib/migrate-canonicals.sh +523 -0
- package/core/lib/mount-repo.sh +543 -0
- package/core/lib/my-wiki-gates.sh +137 -0
- package/core/lib/my-wiki.sh +202 -0
- package/core/lib/my_wiki_build.py +548 -0
- package/core/lib/my_wiki_graph.py +137 -0
- package/core/lib/my_wiki_overview.py +392 -0
- package/core/lib/new-memory.sh +160 -0
- package/core/lib/new-product.sh +122 -0
- package/core/lib/new-workspace.sh +105 -0
- package/core/lib/pack-install.sh +114 -0
- package/core/lib/recall.sh +235 -0
- package/core/lib/recall_index.py +295 -0
- package/core/lib/remote-backup.sh +84 -0
- package/core/lib/rename-heads.sh +354 -0
- package/core/lib/rename-workspaces.sh +271 -0
- package/core/lib/session-read.sh +203 -0
- package/core/lib/session-start.sh +854 -0
- package/core/lib/supersede.sh +436 -0
- package/core/lib/sweep.sh +473 -0
- package/core/manual/COMO-FUNCIONA.md +251 -0
- package/core/manual/HOW-IT-WORKS.md +250 -0
- package/core/resolver.md +30 -0
- package/core/skills/archive.md +95 -0
- package/core/skills/bootstrap.md +226 -0
- package/core/skills/capture.md +65 -0
- package/core/skills/check-resolvable.md +38 -0
- package/core/skills/close-session.md +108 -0
- package/core/skills/grill.md +74 -0
- package/core/skills/mount-repo.md +97 -0
- package/core/skills/my-wiki.md +103 -0
- package/core/skills/new-memory.md +76 -0
- package/core/skills/new-product.md +55 -0
- package/core/skills/new-spec.md +114 -0
- package/core/skills/new-workspace.md +53 -0
- package/core/skills/recall.md +64 -0
- package/core/skills/rename-heads.md +72 -0
- package/core/skills/rename-workspaces.md +43 -0
- package/core/skills/supersede.md +83 -0
- package/core/skills/sweep.md +40 -0
- package/core/templates/my-wiki-graph.js +431 -0
- package/core/templates/my-wiki-overview.js +174 -0
- package/core/templates/my-wiki.html +1017 -0
- package/core/templates/node-folder/README.md +11 -0
- package/core/templates/node-folder/resolver.md +9 -0
- package/core/templates/node-light.md +22 -0
- package/core/templates/node-product/README.md +8 -0
- package/core/templates/node-repo/README.md +14 -0
- package/core/templates/node-repo/context/README.md +22 -0
- package/core/templates/node-repo/context/competitors.md +8 -0
- package/core/templates/node-repo/context/glossary.md +8 -0
- package/core/templates/node-repo/context/open-questions.md +9 -0
- package/core/templates/node-repo/context/opportunities.md +9 -0
- package/core/templates/node-repo/context/problem.md +8 -0
- package/core/templates/node-repo/context/scope.md +8 -0
- package/core/templates/node-repo/context/users.md +8 -0
- package/core/templates/node-repo/context/vision.md +8 -0
- package/core/templates/node-repo/resolver.md +14 -0
- package/core/templates/operator.md +17 -0
- package/core/templates/person.md +10 -0
- package/core/templates/repo-scaffold/ARCHITECTURE.md +3 -0
- package/core/templates/repo-scaffold/CLAUDE.md +23 -0
- package/core/templates/repo-scaffold/decisions.md +3 -0
- package/core/templates/repo-scaffold/evals-run.sh +14 -0
- package/core/templates/repo-scaffold/gitignore +3 -0
- package/core/templates/repo-scaffold/settings.json +8 -0
- package/core/templates/root-resolver.md +5 -0
- package/core/templates/strings.md +1361 -0
- package/core/templates/tree.md +59 -0
- package/core/templates/voice.md +5 -0
- package/package.json +23 -0
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# My Wiki: the brain projected as a navigable page (spec 060). Invocable — `core/skills/my-wiki.md`
|
|
3
|
+
# is its contract.
|
|
4
|
+
#
|
|
5
|
+
# Usage: my-wiki.sh --brain DIR [--out FILE] [--days N] [--week N]
|
|
6
|
+
#
|
|
7
|
+
# --days N the window of Overview's threads, in days. Default 3.
|
|
8
|
+
# --week N the window of Overview's dated tasks, in days. Default 7.
|
|
9
|
+
#
|
|
10
|
+
# IT WRITES OUTSIDE THE BRAIN, ALWAYS. The default destination is `$TMPDIR` (or `/tmp`), and
|
|
11
|
+
# `--out` may name any path outside the brain. A destination inside the brain is refused: the page
|
|
12
|
+
# is derived, it is regenerated in seconds, and a generated file sitting in the brain would show up
|
|
13
|
+
# as work in every scan and every close from then on.
|
|
14
|
+
#
|
|
15
|
+
# IT NEVER PUBLISHES. Publishing is the session's, with the Artifact tool, and a person approves
|
|
16
|
+
# it: this script prints the path of the file it wrote and stops there.
|
|
17
|
+
#
|
|
18
|
+
# NO FORMAT IS PARSED TWICE. The tree comes from `common.sh` (`os_tree_globs`, `os_tree_files`,
|
|
19
|
+
# `os_tree_content_files`), the mount table from `os_mounts_filas`, the runtime prose from
|
|
20
|
+
# `os_lang_load`, and git from git. All of it is handed to `my_wiki_build.py` over stdin, in
|
|
21
|
+
# blocks: that file reads markdown and nothing else.
|
|
22
|
+
#
|
|
23
|
+
# THE PROSE OF THE PAGE IS THE CATALOG'S. `WIKI_STRINGS` below is the one enumeration of which keys
|
|
24
|
+
# of `templates/strings.md` the page carries, in the brain's own language.
|
|
25
|
+
#
|
|
26
|
+
# Exit: 0 the page was written. 1 invalid arguments, or a destination inside the brain.
|
|
27
|
+
|
|
28
|
+
set -u
|
|
29
|
+
|
|
30
|
+
here=$(cd "$(dirname "$0")" && pwd)
|
|
31
|
+
. "$here/common.sh"
|
|
32
|
+
|
|
33
|
+
brain=""
|
|
34
|
+
out=""
|
|
35
|
+
days=""
|
|
36
|
+
week=""
|
|
37
|
+
|
|
38
|
+
while [ $# -gt 0 ]; do
|
|
39
|
+
case "$1" in
|
|
40
|
+
--brain) [ $# -ge 2 ] || os_die "--brain needs a value"; brain="$2"; shift 2 ;;
|
|
41
|
+
--out) [ $# -ge 2 ] || os_die "--out needs a value"; out="$2"; shift 2 ;;
|
|
42
|
+
--days) [ $# -ge 2 ] || os_die "--days needs a value"; days="$2"; shift 2 ;;
|
|
43
|
+
--week) [ $# -ge 2 ] || os_die "--week needs a value"; week="$2"; shift 2 ;;
|
|
44
|
+
*) os_die "unknown argument: $1" ;;
|
|
45
|
+
esac
|
|
46
|
+
done
|
|
47
|
+
|
|
48
|
+
[ -n "$brain" ] || os_die "missing --brain"
|
|
49
|
+
[ -d "$brain" ] || os_die "no such brain: $brain"
|
|
50
|
+
brain=$(cd "$brain" && pwd)
|
|
51
|
+
|
|
52
|
+
command -v python3 > /dev/null 2>&1 || os_die "python3 is required and is not on the PATH"
|
|
53
|
+
|
|
54
|
+
lang=$(os_language "$brain")
|
|
55
|
+
os_lang_load "$lang"
|
|
56
|
+
|
|
57
|
+
# The keys of the catalog the page carries. One enumeration, here.
|
|
58
|
+
WIKI_STRINGS="WIKI_TITLE WIKI_PEOPLE WIKI_CHANGES WIKI_SEARCH WIKI_EDIT WIKI_EDIT_COPIED WIKI_EDIT_PATH WIKI_THREAD_RESUME WIKI_THREAD_COPIED WIKI_APPEARANCE
|
|
59
|
+
WIKI_ACCENT WIKI_TYPE WIKI_SIZE WIKI_THEME WIKI_LIGHT WIKI_DARK WIKI_INITIATIVES WIKI_DOCUMENTS
|
|
60
|
+
WIKI_DEVELOPMENT WIKI_MENTIONS WIKI_NO_ENTITY WIKI_EMPTY WIKI_ENTITIES WIKI_RESULTS
|
|
61
|
+
WIKI_NO_RESULTS WIKI_NO_PEOPLE WIKI_NO_MENTIONS
|
|
62
|
+
WIKI_REPO_UNMOUNTED WIKI_NO_SPECS WIKI_LAST_MERGE WIKI_DECISION WIKI_PERSON WIKI_NOT_FOUND
|
|
63
|
+
WIKI_WROTE WIKI_PUBLISH_HINT WIKI_FILES
|
|
64
|
+
WIKI_GRAPH WIKI_GRAPH_WORKSPACE WIKI_GRAPH_ENTITY WIKI_GRAPH_INITIATIVE WIKI_GRAPH_PERSON
|
|
65
|
+
WIKI_GRAPH_DOCUMENT WIKI_GRAPH_SHOW_DOCS WIKI_GRAPH_SHOW_PEOPLE WIKI_GRAPH_GREW WIKI_GRAPH_PLAY
|
|
66
|
+
WIKI_GRAPH_PAUSE WIKI_GRAPH_PAGES WIKI_GRAPH_LINKS WIKI_GRAPH_HINT WIKI_GRAPH_LABELS
|
|
67
|
+
WIKI_BACK WIKI_FORWARD
|
|
68
|
+
WIKI_OVERVIEW WIKI_THREADS WIKI_THREADS_WINDOW WIKI_NO_THREADS WIKI_NO_SESSIONS WIKI_NO_FOCUS
|
|
69
|
+
WIKI_THREAD_ASKS WIKI_THREAD_GATE1 WIKI_THREAD_UNREAD WIKI_UNREAD_WHY WIKI_GATES WIKI_NO_GATES
|
|
70
|
+
WIKI_GATE_1 WIKI_GATE_2 WIKI_WAITING_OTHERS WIKI_NO_WAITING WIKI_THIS_WEEK WIKI_WEEK_WINDOW
|
|
71
|
+
WIKI_NO_WEEK WIKI_AGO_MIN WIKI_AGO_HOUR WIKI_AGO_DAY WIKI_COUNT_THREADS WIKI_COUNT_GATES
|
|
72
|
+
WIKI_COUNT_WAITING"
|
|
73
|
+
|
|
74
|
+
wsdir=$(os_ws_dir "$brain")
|
|
75
|
+
head_file=$(os_head_file "$brain") || head_file="README.md"
|
|
76
|
+
vault=$(basename "$brain")
|
|
77
|
+
generated=$(date +%Y-%m-%d)
|
|
78
|
+
version=$(os_version)
|
|
79
|
+
[ -n "$days" ] || days=3
|
|
80
|
+
[ -n "$week" ] || week=7
|
|
81
|
+
case "$days$week" in *[!0-9]*) os_die "--days and --week take a whole number of days" ;; esac
|
|
82
|
+
|
|
83
|
+
if [ -z "$out" ]; then
|
|
84
|
+
outdir="${TMPDIR:-/tmp}"
|
|
85
|
+
out="${outdir%/}/my-wiki-$vault.html"
|
|
86
|
+
fi
|
|
87
|
+
case "$out" in
|
|
88
|
+
"$brain"|"$brain"/*) os_die "the page is written outside the brain, never inside it: $out" ;;
|
|
89
|
+
esac
|
|
90
|
+
outdir=$(dirname "$out")
|
|
91
|
+
mkdir -p "$outdir" 2>/dev/null || true
|
|
92
|
+
[ -d "$outdir" ] || os_die "no such destination folder: $outdir"
|
|
93
|
+
|
|
94
|
+
globs=$(os_tree_globs "$brain") || os_die "no tree.md to read in: $brain"
|
|
95
|
+
heads=$(os_tree_files "$brain") || os_die "no tree.md to read in: $brain"
|
|
96
|
+
contents=$(os_tree_content_files "$brain") || os_die "no tree.md to read in: $brain"
|
|
97
|
+
|
|
98
|
+
# The mount table, one row per remote: what the `repo:` of a node resolves to on THIS machine, plus
|
|
99
|
+
# the date of that checkout's last merge. A remote with no row here reaches the page as a repo that
|
|
100
|
+
# is not mounted, and nothing fails.
|
|
101
|
+
mounts=""
|
|
102
|
+
if [ -f "$brain/$OS_MOUNTS_ARCHIVO" ]; then
|
|
103
|
+
while IFS= read -r fila || [ -n "$fila" ]; do
|
|
104
|
+
[ -n "$fila" ] || continue
|
|
105
|
+
remote=""; ruta=""; i=0
|
|
106
|
+
while IFS= read -r celda; do
|
|
107
|
+
i=$(( i + 1 ))
|
|
108
|
+
[ "$i" = "2" ] && remote="$celda"
|
|
109
|
+
[ "$i" = "3" ] && ruta="$celda"
|
|
110
|
+
done <<CELDAS
|
|
111
|
+
$(printf '%s' "$fila" | tr "$OS_SEP" '\n')
|
|
112
|
+
CELDAS
|
|
113
|
+
[ -n "$remote" ] || continue
|
|
114
|
+
merge=""
|
|
115
|
+
if [ -n "$ruta" ] && [ -d "$ruta/.git" ]; then
|
|
116
|
+
merge=$(git -C "$ruta" log -1 --merges --format=%cs 2>/dev/null || true)
|
|
117
|
+
fi
|
|
118
|
+
mounts="$mounts$remote $ruta $merge
|
|
119
|
+
"
|
|
120
|
+
done <<FILAS
|
|
121
|
+
$(os_mounts_filas "$brain/$OS_MOUNTS_ARCHIVO")
|
|
122
|
+
FILAS
|
|
123
|
+
fi
|
|
124
|
+
|
|
125
|
+
# Overview's own inputs (spec 062). The sessions of Claude Code live under
|
|
126
|
+
# `~/.claude/projects/<the brain's path with its punctuation turned into dashes>/`; the folder is
|
|
127
|
+
# resolved here and read —only read— by `my_wiki_overview.py`. A machine with no such folder
|
|
128
|
+
# reaches the page as "no local sessions", and nothing fails.
|
|
129
|
+
sessions="${CLAUDE_CONFIG_DIR:-$HOME/.claude}/projects/$(printf '%s' "$brain" | tr -C 'A-Za-z0-9' '-' | tr -d '\n')"
|
|
130
|
+
[ -d "$sessions" ] || sessions=""
|
|
131
|
+
operator=""
|
|
132
|
+
[ -f "$brain/operator.md" ] && operator=$(os_titulo "$brain/operator.md")
|
|
133
|
+
|
|
134
|
+
# The gates of the mounted repos. Git is read there and only there.
|
|
135
|
+
gates=""
|
|
136
|
+
if [ -n "$mounts" ]; then
|
|
137
|
+
gates=$(printf '%s' "$mounts" | "$here/my-wiki-gates.sh" 2>/dev/null || true)
|
|
138
|
+
fi
|
|
139
|
+
|
|
140
|
+
# Every page's first-commit date, for the Graph screen's "how it grew" (spec 061). ONE git log for
|
|
141
|
+
# the whole brain, full history, never one call per file: `my_wiki_graph.py` walks this once and
|
|
142
|
+
# keeps the earliest date it sees per path, so the order below never has to be chronological.
|
|
143
|
+
history=""
|
|
144
|
+
if [ -d "$brain/.git" ]; then
|
|
145
|
+
history=$(git -C "$brain" log --name-only --no-renames --format="%x01%cs" 2>/dev/null || true)
|
|
146
|
+
fi
|
|
147
|
+
overview_block="sessions $sessions
|
|
148
|
+
today $generated
|
|
149
|
+
now $(date +%Y-%m-%dT%H:%M:%S%z)
|
|
150
|
+
days $days
|
|
151
|
+
week $week
|
|
152
|
+
operator $operator"
|
|
153
|
+
|
|
154
|
+
strings_block=""
|
|
155
|
+
for k in $WIKI_STRINGS; do
|
|
156
|
+
eval "v=\${S_$k:-}"
|
|
157
|
+
# One line per key: the page's labels are labels, never paragraphs.
|
|
158
|
+
v=$(printf '%s' "$v" | tr '\n\t' ' ')
|
|
159
|
+
strings_block="$strings_block$k $v
|
|
160
|
+
"
|
|
161
|
+
done
|
|
162
|
+
|
|
163
|
+
payload="%%STRINGS%%
|
|
164
|
+
$strings_block
|
|
165
|
+
%%GLOBS%%
|
|
166
|
+
$globs
|
|
167
|
+
%%HEADS%%
|
|
168
|
+
$heads
|
|
169
|
+
%%FILES%%
|
|
170
|
+
$contents
|
|
171
|
+
%%MOUNTS%%
|
|
172
|
+
$mounts
|
|
173
|
+
%%HISTORY%%
|
|
174
|
+
$history
|
|
175
|
+
%%OVERVIEW%%
|
|
176
|
+
$overview_block
|
|
177
|
+
%%GATES%%
|
|
178
|
+
$gates"
|
|
179
|
+
|
|
180
|
+
result=$(printf '%s\n' "$payload" | python3 "$here/my_wiki_build.py" \
|
|
181
|
+
"$brain" "$wsdir" "$head_file" "$vault" "$here/../templates/my-wiki.html" \
|
|
182
|
+
"$out" "$generated" "$version")
|
|
183
|
+
rc=$?
|
|
184
|
+
if [ "$rc" != "0" ]; then
|
|
185
|
+
printf 'error: my-wiki.sh could not build the page\n' >&2
|
|
186
|
+
exit 1
|
|
187
|
+
fi
|
|
188
|
+
|
|
189
|
+
wrote=""; bytes=""; pages=""; spaces=""; i=0
|
|
190
|
+
while IFS= read -r celda; do
|
|
191
|
+
i=$(( i + 1 ))
|
|
192
|
+
[ "$i" = "1" ] && wrote="$celda"
|
|
193
|
+
[ "$i" = "2" ] && bytes="$celda"
|
|
194
|
+
[ "$i" = "3" ] && pages="$celda"
|
|
195
|
+
[ "$i" = "4" ] && spaces="$celda"
|
|
196
|
+
done <<COLS
|
|
197
|
+
$(printf '%s' "$result" | tr '\t' '\n')
|
|
198
|
+
COLS
|
|
199
|
+
|
|
200
|
+
printf "$S_WIKI_WROTE\n" "$wrote" "$(( bytes / 1024 ))" "$pages" "$spaces"
|
|
201
|
+
printf '%s\n' "$S_WIKI_PUBLISH_HINT"
|
|
202
|
+
exit 0
|