ai-first-os 1.10.0 → 2.0.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.
Files changed (60) hide show
  1. package/README.md +33 -31
  2. package/core/CLAUDE.md +48 -12
  3. package/core/VERSION +1 -1
  4. package/core/install.sh +173 -52
  5. package/core/lib/bootstrap.sh +41 -26
  6. package/core/lib/build-indexes.sh +283 -0
  7. package/core/lib/capture.sh +126 -55
  8. package/core/lib/check-resolvable.sh +13 -2
  9. package/core/lib/close-session.sh +172 -119
  10. package/core/lib/common.sh +505 -92
  11. package/core/lib/focus-read.sh +94 -58
  12. package/core/lib/manual-link.sh +10 -8
  13. package/core/lib/markdown.py +2 -2
  14. package/core/lib/migrate-layout.sh +92 -0
  15. package/core/lib/migrate-root.sh +497 -0
  16. package/core/lib/migrate_layout.py +2000 -0
  17. package/core/lib/new-memory.sh +33 -44
  18. package/core/lib/new-product.sh +11 -13
  19. package/core/lib/new-workspace.sh +18 -9
  20. package/core/lib/orchestrator-init.sh +80 -0
  21. package/core/lib/pack-install.sh +44 -30
  22. package/core/lib/recall.sh +1 -1
  23. package/core/lib/recall_index.py +48 -6
  24. package/core/lib/remote-backup.sh +30 -20
  25. package/core/lib/rename-heads.sh +8 -8
  26. package/core/lib/rename-workspaces.sh +3 -3
  27. package/core/lib/session-read.sh +133 -73
  28. package/core/lib/session-start.sh +238 -221
  29. package/core/lib/supersede.sh +199 -3
  30. package/core/lib/sweep.sh +5 -0
  31. package/core/manual/COMO-FUNCIONA.md +169 -58
  32. package/core/manual/HOW-IT-WORKS.md +158 -57
  33. package/core/resolver.md +4 -2
  34. package/core/skills/bootstrap.md +63 -44
  35. package/core/skills/capture.md +15 -8
  36. package/core/skills/check-resolvable.md +1 -1
  37. package/core/skills/close-session.md +9 -5
  38. package/core/skills/grill.md +3 -3
  39. package/core/skills/migrate-layout.md +48 -0
  40. package/core/skills/migrate-root.md +64 -0
  41. package/core/skills/mount-repo.md +6 -6
  42. package/core/skills/new-memory.md +20 -18
  43. package/core/skills/new-product.md +4 -3
  44. package/core/skills/new-spec.md +6 -0
  45. package/core/skills/new-workspace.md +7 -5
  46. package/core/skills/orchestrator.md +101 -0
  47. package/core/skills/supersede.md +14 -0
  48. package/core/templates/node-repo/context/open-questions.md +3 -0
  49. package/core/templates/strings.md +396 -271
  50. package/core/templates/tree.md +22 -27
  51. package/package.json +1 -1
  52. package/core/lib/my-wiki-gates.sh +0 -137
  53. package/core/lib/my-wiki.sh +0 -202
  54. package/core/lib/my_wiki_build.py +0 -548
  55. package/core/lib/my_wiki_graph.py +0 -137
  56. package/core/lib/my_wiki_overview.py +0 -392
  57. package/core/skills/my-wiki.md +0 -103
  58. package/core/templates/my-wiki-graph.js +0 -431
  59. package/core/templates/my-wiki-overview.js +0 -174
  60. package/core/templates/my-wiki.html +0 -1017
@@ -5,10 +5,10 @@ reads these lines. Adding a level is adding a line here, not touching scripts.
5
5
 
6
6
  - `glob:` — what a scan reads as a head: frontmatter with `status`, `horizon`, and so on.
7
7
  - `content:` — what a scan counts as reached but **never** reads as a head: the voice, a record, the
8
- `context/` and the `research/` of a product node, the body of an initiative next to its `README.md`,
9
- the body of a decision or a learning next to its index (`decisions.md`/`learnings.md`, spec 043), a
10
- workspace's `people/` (spec 058) — who a person is, never a node, and never what the scan or the
11
- focus load on their own.
8
+ `context/`, `research/` and `resources/` of a node, the body of an initiative next to its
9
+ `README.md`, one file per decision or learning in the workspace's `decisions/` and `learnings/`
10
+ (spec 076), the `index.md` the startup read generates, a workspace's `people/` (spec 058) — who a
11
+ person is, never a node, and never what the scan or the focus load on their own.
12
12
  Without this line, that file gets flagged as unreached by any glob even when it is written correctly.
13
13
  - `archive:` — what a scan counts as reached, never reads as a head, and **never loads**: the
14
14
  `archive/` of a node (spec 048). The focus prints the names of these files and opens none of them;
@@ -21,39 +21,34 @@ two reaches is a finding of the check, not a case to ignore.
21
21
  The first `content:` line is the system's user manual, in the language of this brain: it is part of
22
22
  the product, it lives at the root so it can be read from Obsidian, and it is never work.
23
23
 
24
- glob: operator.md
25
- glob: resolver.md
26
- glob: inbox.md
27
- glob: mounts.md
28
- glob: initiatives/*/README.md
29
- glob: backlog.md
30
- glob: decisions.md
31
- glob: learnings.md
24
+ This file lives in `.system/` with the root resolver and the mounts table: the machinery of the root.
25
+ The account (`account/`) is what the person edits.
26
+
27
+ glob: account/operator.md
28
+ glob: .system/resolver.md
29
+ glob: .system/mounts.md
32
30
  glob: workspaces/*/README.md
33
- glob: workspaces/*/resolver.md
34
- glob: workspaces/*/backlog.md
35
- glob: workspaces/*/decisions.md
36
- glob: workspaces/*/learnings.md
31
+ glob: workspaces/*/.resolver.md
37
32
  glob: workspaces/*/initiatives/*/README.md
38
33
  glob: workspaces/*/products/*/README.md
39
- glob: workspaces/*/products/*/resolver.md
40
- glob: workspaces/*/products/*/decisions.md
34
+ glob: workspaces/*/products/*/.resolver.md
41
35
 
42
36
  content: {{MANUAL}}
43
- content: voice.md
44
- content: voice/*.md
45
- content: workspaces/*/voice.md
37
+ content: account/voice/*.md
38
+ content: account/voice/*/*.md
39
+ content: workspaces/*/context/*.md
40
+ content: workspaces/*/resources/*.md
41
+ content: workspaces/*/resources/*/*.md
46
42
  content: workspaces/*/records/*.md
47
43
  content: workspaces/*/people/*.md
48
- content: workspaces/*/products/*/context/*.md
49
- content: workspaces/*/products/*/research/*.md
50
- content: initiatives/*/*.md
51
44
  content: workspaces/*/initiatives/*/*.md
52
- content: decisions/*.md
53
- content: learnings/*.md
54
45
  content: workspaces/*/decisions/*.md
55
46
  content: workspaces/*/learnings/*.md
47
+ content: workspaces/*/products/*/index.md
48
+ content: workspaces/*/products/*/context/*.md
49
+ content: workspaces/*/products/*/research/*.md
50
+ content: workspaces/*/products/*/resources/*.md
51
+ content: workspaces/*/products/*/resources/*/*.md
56
52
 
57
53
  archive: workspaces/*/products/*/archive/*.md
58
54
  archive: workspaces/*/initiatives/*/archive/*.md
59
- archive: initiatives/*/archive/*.md
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ai-first-os",
3
- "version": "1.10.0",
3
+ "version": "2.0.0",
4
4
  "description": "A product operating system for working with agents. Install with npx, no clone required.",
5
5
  "license": "MIT",
6
6
  "homepage": "https://github.com/pedroromeroluna/ai-first-os",
@@ -1,137 +0,0 @@
1
- #!/usr/bin/env bash
2
- # The gates of the mounted repos, for My Wiki's Overview (spec 062, C4). Internal: it is called by
3
- # `my-wiki.sh` and has no `command:` header of its own.
4
- #
5
- # Usage: my-wiki-gates.sh — the mount rows arrive on stdin, one per line:
6
- # remote<TAB>local path<TAB>last merge date
7
- #
8
- # Prints one row per gate, tab separated:
9
- # gate<TAB>repo<TAB>spec file<TAB>title<TAB>date<TAB>branch
10
- #
11
- # gate `1` a spec of `specs/` that declares it is waiting for its Gate 1
12
- # `2` a branch that declares `status: implementada` in `specs/done/` and is not merged
13
- # date the day the row can be aged from: the spec file's own last change for a Gate 1, the
14
- # branch's last commit for a Gate 2.
15
- #
16
- # GIT IS READ HERE AND NOWHERE ELSE. `my_wiki_overview.py` never shells out: the branch state of a
17
- # repo is git's answer, and it arrives already resolved, the same way the tree and the mount table
18
- # do. A repo this machine did not mount produces no rows and no error.
19
-
20
- set -u
21
-
22
- here=$(cd "$(dirname "$0")" && pwd)
23
- . "$here/common.sh"
24
-
25
- # A spec's `status:` that means "a person has to approve it before anything is implemented". The
26
- # list is here, once: `pendiente`/`pending` is what the product writes today, and `esperando gate 1`
27
- # is what a spec writes when it says so in full.
28
- GATE1_STATES="pendiente pending esperando-gate-1 waiting-gate-1"
29
- # What a branch declares when it says its work is finished and is asking to be merged.
30
- GATE2_STATE="implementada"
31
-
32
- norm() { printf '%s' "$1" | tr 'A-Z' 'a-z' | tr ' _' '--'; }
33
-
34
- is_gate1() {
35
- local want; want=$(norm "$1")
36
- local s
37
- for s in $GATE1_STATES; do [ "$want" = "$s" ] && return 0; done
38
- return 1
39
- }
40
-
41
- # The last two segments of a remote — `owner/repo` — which is how a person names it.
42
- short_repo() {
43
- local r="${1%/}" last rest
44
- case "$r" in *.git) r="${r%.git}" ;; esac
45
- last="${r##*/}"
46
- rest="${r%/*}"
47
- if [ "$rest" = "$r" ]; then printf '%s' "$last"; else printf '%s/%s' "${rest##*/}" "$last"; fi
48
- }
49
-
50
- # The `status:` of a file's frontmatter, read off a stream. `fm_read` takes a path and this reads
51
- # what `git show` prints, which never touches the working tree.
52
- fm_status_of_stream() {
53
- local line n=0
54
- while IFS= read -r line; do
55
- n=$(( n + 1 ))
56
- if [ "$n" = "1" ]; then [ "$line" = "---" ] || return 0; continue; fi
57
- [ "$line" = "---" ] && return 0
58
- [ "$n" -ge 60 ] && return 0
59
- case "$line" in
60
- status:*) printf '%s' "$(os_trim "${line#status:}")"; return 0 ;;
61
- estado:*) printf '%s' "$(os_trim "${line#estado:}")"; return 0 ;;
62
- esac
63
- done
64
- return 0
65
- }
66
-
67
- # The `# ` heading of a file, read off the same stream.
68
- title_of_stream() {
69
- local line
70
- while IFS= read -r line; do
71
- case "$line" in '# '*) printf '%s' "${line#\# }"; return 0 ;; esac
72
- done
73
- return 0
74
- }
75
-
76
- while IFS= read -r row || [ -n "$row" ]; do
77
- [ -n "$row" ] || continue
78
- remote=""; path=""; i=0
79
- while IFS= read -r cell; do
80
- i=$(( i + 1 ))
81
- [ "$i" = "1" ] && remote="$cell"
82
- [ "$i" = "2" ] && path="$cell"
83
- done <<CELLS
84
- $(printf '%s' "$row" | tr '\t' '\n')
85
- CELLS
86
- [ -n "$path" ] || continue
87
- [ -d "$path/.git" ] || continue
88
- short=$(short_repo "$remote")
89
-
90
- # --- Gate 1: a spec of the working tree that is waiting for a person to approve it.
91
- if [ -d "$path/specs" ]; then
92
- for file in "$path"/specs/*.md; do
93
- [ -f "$file" ] || continue
94
- fm_read "$file"
95
- is_gate1 "${fm_status:-}" || continue
96
- title=$(os_titulo "$file")
97
- [ -n "$title" ] || title=$(basename "$file" .md)
98
- when=$(git -C "$path" log -1 --format=%cs -- "specs/$(basename "$file")" 2>/dev/null || true)
99
- [ -n "$when" ] || when=""
100
- printf '1\t%s\t%s\t%s\t%s\t\n' "$short" "specs/$(basename "$file")" "$title" "$when"
101
- done
102
- fi
103
-
104
- # --- Gate 2: a branch that declares itself finished and is not in the default branch yet.
105
- #
106
- # THE BRANCH IS READ FROM GIT, NEVER FROM THE WORKING TREE. What the checkout has on disk is one
107
- # branch; a branch that finished and is waiting to be merged is usually not that one, and its
108
- # `specs/done/` only exists inside the branch.
109
- base=$(git -C "$path" symbolic-ref --quiet --short refs/remotes/origin/HEAD 2>/dev/null || true)
110
- base="${base#origin/}"
111
- if [ -z "$base" ]; then
112
- for cand in main master; do
113
- git -C "$path" rev-parse --verify --quiet "refs/heads/$cand" > /dev/null 2>&1 && { base="$cand"; break; }
114
- done
115
- fi
116
- [ -n "$base" ] || continue
117
- branches=$(git -C "$path" for-each-ref --format='%(refname:short)' refs/heads 2>/dev/null || true)
118
- for branch in $branches; do
119
- [ "$branch" = "$base" ] && continue
120
- git -C "$path" merge-base --is-ancestor "$branch" "$base" > /dev/null 2>&1 && continue
121
- # WHAT THE BRANCH ADDED, not what the branch holds: `specs/done/` drags along everything
122
- # already merged, and every branch would claim the finished work of all the ones before it.
123
- done_files=$(git -C "$path" diff --name-only --diff-filter=AM "$base...$branch" -- specs/done/ 2>/dev/null || true)
124
- [ -n "$done_files" ] || continue
125
- when=$(git -C "$path" log -1 --format=%cs "$branch" 2>/dev/null || true)
126
- for done_file in $done_files; do
127
- case "$done_file" in *.md) ;; *) continue ;; esac
128
- state=$(git -C "$path" show "$branch:$done_file" 2>/dev/null | fm_status_of_stream)
129
- [ "$(norm "${state:-}")" = "$GATE2_STATE" ] || continue
130
- title=$(git -C "$path" show "$branch:$done_file" 2>/dev/null | title_of_stream)
131
- [ -n "$title" ] || title=$(basename "$done_file" .md)
132
- printf '2\t%s\t%s\t%s\t%s\t%s\n' "$short" "$done_file" "$title" "$when" "$branch"
133
- done
134
- done
135
- done
136
-
137
- exit 0
@@ -1,202 +0,0 @@
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