@codewizard-dt/bootstrap 2.20.0 → 2.23.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/lib/scripts/README.md +8 -6
- package/lib/scripts/backfill-wiki-aliases.js +161 -0
- package/lib/scripts/install-global.sh +4 -2
- package/lib/scripts/install-obsidian.sh +69 -2
- package/lib/scripts/lib.sh +21 -4
- package/lib/scripts/merge-gitignore.sh +152 -95
- package/lib/scripts/setup-deployment.sh +1 -1
- package/lib/scripts/sync-wiki-scaffold.sh +13 -6
- package/lib/scripts/templates/bootstrap-prefs-schema.json +16 -7
- package/lib/scripts/templates/file-suggestion.sh +13 -5
- package/lib/scripts/templates/obsidian/graph.json +23 -0
- package/lib/scripts/templates/wiki/work/bugs/archive/index.md +4 -0
- package/lib/scripts/templates/wiki/work/decisions/archive/index.md +4 -0
- package/lib/scripts/templates/wiki/work/requirements/archive/index.md +4 -0
- package/lib/scripts/templates/wiki/work/roadmaps/archive/index.md +4 -0
- package/lib/scripts/templates/wiki/work/tasks/archive/index.md +4 -0
- package/lib/scripts/templates/wiki/work/uat/archive/index.md +4 -0
- package/lib/skills/bootstrap-config/SKILL.md +8 -2
- package/lib/skills/bug-file/SKILL.md +1 -0
- package/lib/skills/decision-create/SKILL.md +5 -0
- package/lib/skills/req-create/SKILL.md +1 -0
- package/lib/skills/roadmap-create/SKILL.md +1 -0
- package/lib/skills/task-add/SKILL.md +1 -0
- package/lib/skills/uat-generate/SKILL.md +1 -0
- package/package.json +1 -1
package/lib/scripts/README.md
CHANGED
|
@@ -20,12 +20,13 @@ All scripts use `set -euo pipefail`. Every script that touches a target project
|
|
|
20
20
|
|
|
21
21
|
| Script | Used by | Purpose |
|
|
22
22
|
|--------|---------|---------|
|
|
23
|
-
| `lib.sh` | Every script above | Shared bash library: `resolve_project_dir` (path resolution + validation), `mcp_installed`/`serena_installed`/`detect_installed_mcps` (MCP state checks), `run_project_sync` (the common setup/update sequence: `install-global.sh --skip-mcps` first — hooks/skills/deny-list/hooks-wiring/fileSuggestion, offline-safe — then the guarded interactive MCP install, wiki scaffold, gitignore, MCP-tools guide, Serena bootstrap), and `prompt_yn`/`prompt_scope` (interactive prompt helpers). |
|
|
23
|
+
| `lib.sh` | Every script above | Shared bash library: `resolve_project_dir` (path resolution + validation), `mcp_installed`/`serena_installed`/`detect_installed_mcps` (MCP state checks), `run_project_sync` (the common setup/update sequence: `install-global.sh --skip-mcps` first — hooks/skills/deny-list/hooks-wiring/fileSuggestion, offline-safe — then the guarded interactive MCP install, wiki scaffold, gitignore, the wiki-alias backfill, Obsidian, MCP-tools guide, Serena bootstrap), and `prompt_yn`/`prompt_scope` (interactive prompt helpers). |
|
|
24
24
|
| `install-mcps.sh` | `install-global.sh`, `setup-project.sh`, `update-project.sh` | Installs Brave Search, Context7, Playwright, and (when a project dir is given) Serena. Two modes: non-interactive (`install-global.sh`'s default — installs everything missing at user scope) and `--interactive --project-dir <dir>` (prompts per-MCP and asks for scope, used by `setup`/`update`). Playwright has a dedicated conflict flow: registered as `playwright` (user scope) by default; when a project ships its own `playwright`, a git-tracked `.mcp.json` is never modified (interactive options: register ours as `playwright-shared` + disable the project entry machine-locally via `disabledMcpjsonServers` in `.claude/settings.local.json` / register alongside / skip), while a machine-local registration can be replaced or kept (ours then uses the alternate name). Non-interactive conflicts are left untouched with a hint. |
|
|
25
25
|
| `sync-wiki-scaffold.sh` | `setup-project.sh`, `update-project.sh`, `migrate-project.sh` | Scaffolds an **empty** wiki into the target project from `templates/wiki/`: creates `raw/` + all `wiki/` family directories, lifecycle docs, per-family `index.md`, and stub `index.md`/`log.md`. Copy-once for project-owned files; always-refreshes `conventions.md` and `lifecycle.md`. Delivers guides from `raw/guides/` tier-wise into `wiki/guides/`: `command-anti-patterns.md` required (always refreshed); `evals-framework.md` + `type-checking-templates/` optional (`--interactive` prompts on first delivery, sticky refresh once present — legacy `.docs/guides/` presence counts, opt out by deleting); migrates legacy `.docs/guides/` (template-owned files removed or relocated, deprecated `task-spec.md` deleted, empty dirs pruned). Also delivers the `## LLM Wiki` section and `.env` safety policy (copy-once, sentinel-guarded, from `templates/CLAUDE-wiki.md` / `templates/CLAUDE-env-safety.md`) into the target's `CLAUDE.md` — when a `CLAUDE.md` already exists without the schema, prompts whether to modify it or write `CLAUDE.local.md` instead (non-interactive default: `CLAUDE.local.md`). |
|
|
26
26
|
| `build-mcp-guide.sh` | `setup-project.sh`, `update-project.sh`, `migrate-project.sh` | Assembles `wiki/guides/mcp-tools.md` in the target project from the per-server stub files in `templates/guides/stubs/`, including only the sections for MCPs actually installed. |
|
|
27
27
|
| `bootstrap-serena.sh` | `setup-project.sh`, `update-project.sh` | Headlessly triggers `.serena/project.yml` creation via `claude --print` and enables the optional Serena tools needed by this template's workflow. Preflights `claude` and `python3`. |
|
|
28
|
-
| `
|
|
28
|
+
| `backfill-wiki-aliases.js` | `lib.sh` (`run_project_sync`, unguarded — invoked via `node`, not direct exec) | Zero-dependency Node script that re-runs TASK-064's one-time sweep on every `setup`/`update`: scans every `wiki/work/<family>/` file (active + `archive/`, all 6 families) for one that carries `id:` but no `aliases:` yet, and inserts `aliases: [<id>]` immediately after the `id:` line. Idempotent and additive-only — a file that already has `aliases:` (inline or block-list form) is left completely untouched, never corrected or overwritten. Fixes drift (a hand-authored file, an older bootstrap checkout, a merge) that would otherwise leave a bare `[[TASK-NNN]]`-style wikilink dead in Obsidian — see `wiki/knowledge/sources/obsidian-alias-link-resolution.md` for why. Deliberately **out of scope: `wiki/knowledge/`** — a knowledge page's filename already equals its `id:` slug, so its wikilinks already resolve on Obsidian's plain filename match with no alias needed, and existing knowledge-page aliases are curated alternate names a script has no safe way to invent. Always exits 0 (same contract as `merge-settings-deny.js`/`merge-settings-hooks.js`) — warns and skips on anything unexpected rather than aborting the caller. |
|
|
29
|
+
| `merge-gitignore.sh` | `setup-project.sh`, `update-project.sh` | Fully interactive `.gitignore` merge — **nothing is ever added without asking**. The packaged template's titled sections are offered one by one (`Add/update .gitignore section '<title>' (N new line(s))? [y/N]`); sections with nothing new are skipped silently. Non-interactive runs (or no tty) change nothing at all. Never touches existing project content. Also offers (git repos only) to keep `.serena/`/`raw/`/`wiki/` out of git via **`.git/info/exclude`** — never `.gitignore`, which would blind Serena on the wiki (see `wiki/knowledge/concepts/git-ignore-tool-visibility.md`); per-machine and idempotent. `info/exclude` *is* honored by ripgrep-class walkers and the `@` file picker, so every machine-local exclusion this script manages — the wiki/agent-state dirs AND the `.claude/bootstrap-prefs.*` files, whichever of its prompts get answered and in whichever order — is written under **one shared, generic sentinel** (`# bootstrap machine-local (autocomplete-visible)`) that the `fileSuggestion` picker installed by `install-global.sh` reads back to restore `@`-autocomplete. The sentinel line itself is written proactively on every interactive run against a git repo, even if every exclude-affecting prompt is declined, so the anchor is always there regardless of which preferences got set; a project still carrying the old, separately-named pre-unification header is repaired onto the shared sentinel automatically. |
|
|
29
30
|
| `merge-settings-deny.js` | `install-global.sh` | Zero-dependency Node script that merges the canonical permission deny list (`templates/settings-deny.json` — `Bash(...)` command patterns plus `Edit(...)`/`Read(...)` file-tool patterns) into `~/.claude/settings.json` `permissions.deny`. Entries are opaque strings, so any rule form the permission system accepts merges unchanged. Additive union only: missing entries are appended, user entries are never removed or reordered, all other settings keys pass through untouched. Atomic write, preserves existing indentation, and always exits 0 (warns + skips on unparseable or unexpected file shapes so an install never aborts over a settings merge). `--target`/`--source` flags exist as test seams. A second mode, `--set-key <name> --set-value <json>`, merges a single top-level settings key instead of the deny list (used to register `fileSuggestion`): absent → set; already deep-equal → no-op; present but different → one-line warning and skip, never a clobber. Supplying `--set-key` skips the deny merge entirely; a malformed `--set-value` exits 1, since that is a call-site bug rather than a user's file. |
|
|
30
31
|
| `merge-settings-hooks.js` | `install-global.sh` | Zero-dependency Node sibling of `merge-settings-deny.js` (deliberately not a new mode of it — different, block-and-entry-aware semantics) that merges the canonical hook wiring (`templates/settings-hooks.json`) into the `hooks` key of `~/.claude/settings.json` with a "template owns its blocks" model: repo-owned entries (a `command` under `~/.claude/hooks/` whose basename appears in the template) are created or updated in place; matcher drift on a pure-owned block is adopted (a matcher rename ships without duplicating the block); user/foreign blocks and entries are never modified, reordered, or removed; a repo hook found relocated into a mixed block is warned about but not duplicated; no empty placeholder blocks are ever written. Always exits 0 (warns + skips on unparseable or unexpected file shapes so an install never aborts over a settings merge). `--target`/`--source` flags exist as test seams. |
|
|
31
32
|
| `bootstrap-prefs.js` | `install-global.sh`, `install-mcps.sh`, `sync-wiki-scaffold.sh`, `merge-gitignore.sh`, `update-project.sh` (all through the `prefs_*` / `prompt_*_sticky` wrappers in `lib.sh`), and the `/bootstrap-config` skill | Zero-dependency Node reader/writer for the preference store — the one binary every consumer goes through, so no prompt site keeps its own copy of a key's value list. Five operations: `--get` (a resolving read; always exits 0, so no call site needs `\|\| true`), `--set`, `--unset`, `--list`, and `--section-key <title>` (turns a `.gitignore` banner title into its `gitignore.section.<slug>` key, so the slug rule has exactly one implementation and is Unicode-aware). `--set`/`--unset` require **exactly one** layer selector (`--global` / `--project <dir>` / `--target <path>`) and will not guess — a misdirected write is unrecoverable in a way a misdirected read is not; `--get` resolves across layers by default for the mirror-image reason. Values are validated against the schema's `values` grammar (an illegal value exits 1 — a caller bug must never land in the file and read back as `unset`), and `--set` also refuses to write into a layer the key's `scope` forbids (`--target` stays exempt); writes are atomic and reuse the file's existing indentation; and every successful `--set`/`--unset` regenerates the `bootstrap-prefs.README.md` companion beside the values file. See [Preference helper notes](#preference-helper-notes). |
|
|
@@ -367,7 +368,7 @@ real `lib/scripts/` file or one real `lib/skills/<name>/SKILL.md`, so
|
|
|
367
368
|
`"install-global.sh, /git-commit"` fails the suite by construction. Where a
|
|
368
369
|
run-time prompt exists, it is documented in the key's `detail`.
|
|
369
370
|
|
|
370
|
-
### The key registry — all
|
|
371
|
+
### The key registry — all 23 entries
|
|
371
372
|
|
|
372
373
|
Every key in `templates/bootstrap-prefs-schema.json`, grouped by `consumer` —
|
|
373
374
|
`installer` first, then `skill` — which is the same grouping and the same order
|
|
@@ -376,7 +377,7 @@ schema's `default` field; `unset` in that column means `default: null`, i.e. the
|
|
|
376
377
|
key resolves to `unset` until it is answered. This table is transcribed from the
|
|
377
378
|
JSON; if the two ever disagree, the JSON is right and this table is a bug.
|
|
378
379
|
|
|
379
|
-
#### `consumer: installer` —
|
|
380
|
+
#### `consumer: installer` — 17 entries, read by the setup/update scripts
|
|
380
381
|
|
|
381
382
|
| Key | Scope | Consumer | Values | Default | Asked by | What it does |
|
|
382
383
|
|-----|-------|----------|--------|---------|----------|--------------|
|
|
@@ -385,7 +386,7 @@ JSON; if the two ever disagree, the JSON is right and this table is a bug.
|
|
|
385
386
|
| `mcp.playwrightConflict` | project | installer | `shared \| alongside \| skip` | `unset` | `install-mcps.sh` | How to resolve a committed `.mcp.json` that already registers its own playwright server |
|
|
386
387
|
| `mcp.playwrightReplace` | project | installer | `true \| false` | `unset` | `install-mcps.sh` | Replace an existing machine-local Playwright registration with the bootstrap shared server |
|
|
387
388
|
| `update.legacyDocsAck` | project | installer | `true \| false` | `unset` | `update-project.sh` | Continue `update` even though a legacy `.docs/` directory was detected |
|
|
388
|
-
| `gitignore.infoExclude` | project | installer | `true \| false` | `unset` | `merge-gitignore.sh` |
|
|
389
|
+
| `gitignore.infoExclude` | project | installer | `true \| false` | `unset` | `merge-gitignore.sh` | Add `.serena/`, `raw/`, and `wiki/` to git's local ignore list via `.git/info/exclude` |
|
|
389
390
|
| `prefs.gitTracking` | project | installer | `gitignore \| exclude \| neither` | `unset` | `merge-gitignore.sh` | How git should treat `.claude/bootstrap-prefs.json` and `bootstrap-prefs.README.md` |
|
|
390
391
|
| `guides.*` **(pattern)** | project | installer | `true \| false` | `unset` | `sync-wiki-scaffold.sh` | Install a specific optional guide into `wiki/guides/` |
|
|
391
392
|
| `gitignore.section.*` **(pattern)** | project | installer | `false` | `unset` | `merge-gitignore.sh` | Permanently decline one titled `.gitignore` template section |
|
|
@@ -394,7 +395,8 @@ JSON; if the two ever disagree, the JSON is right and this table is a bug.
|
|
|
394
395
|
| `mcp.context7Scope` | global | installer | `user \| project` | `unset` | `lib.sh` | Registration scope for the Context7 MCP |
|
|
395
396
|
| `mcp.playwright` | global | installer | `true \| false` | `unset` | `install-mcps.sh` | Install the Playwright MCP for browser automation and UI testing |
|
|
396
397
|
| `obsidian.installApp` | global | installer | `true \| false` | `unset` | `install-obsidian.sh` | Install the Obsidian desktop app via the native package manager |
|
|
397
|
-
| `obsidian.plugins` | project | installer | `true \| false` | `unset` | `install-obsidian.sh` | Install the bundled Obsidian plugin set (Dataview, Graph Link Types, Breadcrumbs) |
|
|
398
|
+
| `obsidian.plugins` | project | installer | `true \| false` | `unset` | `install-obsidian.sh` | Install the bundled Obsidian plugin set (Dataview, Graph Link Types, Breadcrumbs, Front Matter Title, Alias Linker) |
|
|
399
|
+
| `obsidian.graphDefaults` | project | installer | `true \| false` | `unset` | `install-obsidian.sh` | Install default graph-view styling (`.obsidian/graph.json`) |
|
|
398
400
|
| `skills.pruneOrphans` | global | installer | `true \| false` | `unset` | `install-global.sh` | Delete stale skill folders in `~/.claude/skills/` left by the wiki rename |
|
|
399
401
|
|
|
400
402
|
The two **(pattern)** rows carry `"dynamic": true` and are key *families*, not
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// Backfill `aliases: [<id>]` onto every wiki/work/ work-item file that has an
|
|
3
|
+
// id: field but no aliases: field yet — a repeatable version of TASK-064's
|
|
4
|
+
// one-time sweep (see
|
|
5
|
+
// wiki/work/tasks/archive/TASK-064-backfill-work-item-aliases.md), run on
|
|
6
|
+
// every setup/update so drift (a hand-authored file, an older bootstrap
|
|
7
|
+
// checkout, a merge) gets corrected automatically instead of silently
|
|
8
|
+
// reintroducing dead Obsidian wikilinks. Root cause is documented in
|
|
9
|
+
// wiki/knowledge/sources/obsidian-alias-link-resolution.md: Obsidian's
|
|
10
|
+
// wikilink click-resolver matches only real filenames, never frontmatter, so
|
|
11
|
+
// a work-item file named "<ID>-slug.md" never resolves a bare "[[<ID>]]"
|
|
12
|
+
// link unless its frontmatter carries a matching alias (the Alias Linker
|
|
13
|
+
// plugin, bundled by install-obsidian.sh, is what makes that fallback work).
|
|
14
|
+
//
|
|
15
|
+
// SCOPE: wiki/work/<family>/ only (requirements, decisions, roadmaps, tasks,
|
|
16
|
+
// uat, bugs), both the active directory and archive/. Knowledge pages
|
|
17
|
+
// (wiki/knowledge/) are deliberately NOT covered — a knowledge page's
|
|
18
|
+
// filename already equals its id: slug (e.g. serena-mcp-scope.md has
|
|
19
|
+
// id: serena-mcp-scope), so every existing `[[serena-mcp-scope]]`-style link
|
|
20
|
+
// already resolves on Obsidian's plain filename match, the very first step
|
|
21
|
+
// of resolution, before aliases: is ever consulted. Knowledge-page aliases
|
|
22
|
+
// are curated alternate names (e.g. id: andrej-karpathy -> aliases:
|
|
23
|
+
// [Karpathy]) added at ingest time by human/LLM judgment, not a mechanical
|
|
24
|
+
// function of id: or title: — a script has no safe value to invent there.
|
|
25
|
+
//
|
|
26
|
+
// IDEMPOTENT AND ADDITIVE-ONLY: a file that already has an aliases: field
|
|
27
|
+
// (any value) is left untouched — this only fills a gap, it never corrects
|
|
28
|
+
// or overwrites an existing alias.
|
|
29
|
+
//
|
|
30
|
+
// Always exits 0 — the caller (lib.sh's run_project_sync) must never abort a
|
|
31
|
+
// setup/update over a wiki content backfill. Warns to stderr and skips on
|
|
32
|
+
// anything unexpected (a project with no wiki/work/ yet, an unreadable or
|
|
33
|
+
// unwritable file, a malformed id: line) rather than failing.
|
|
34
|
+
//
|
|
35
|
+
// Usage: backfill-wiki-aliases.js <path-to-project>
|
|
36
|
+
|
|
37
|
+
'use strict';
|
|
38
|
+
|
|
39
|
+
const fs = require('fs');
|
|
40
|
+
const path = require('path');
|
|
41
|
+
|
|
42
|
+
const FAMILIES = ['requirements', 'decisions', 'roadmaps', 'tasks', 'uat', 'bugs'];
|
|
43
|
+
const EXCLUDED_BASENAMES = new Set(['index.md', 'lifecycle.md', '.gitkeep']);
|
|
44
|
+
|
|
45
|
+
/** Recursively collect every .md file under `dir` (active + archive/, since
|
|
46
|
+
* archive/ lives inside each family dir), skipping excluded meta filenames
|
|
47
|
+
* and the wiki/work/uat/screenshots/ directory (not a work-item directory). */
|
|
48
|
+
function collectMarkdownFiles(dir) {
|
|
49
|
+
if (!fs.existsSync(dir)) return [];
|
|
50
|
+
const out = [];
|
|
51
|
+
for (const entry of fs.readdirSync(dir, { withFileTypes: true })) {
|
|
52
|
+
if (entry.name === 'screenshots') continue; // wiki/work/uat/screenshots/
|
|
53
|
+
const full = path.join(dir, entry.name);
|
|
54
|
+
if (entry.isDirectory()) {
|
|
55
|
+
out.push(...collectMarkdownFiles(full));
|
|
56
|
+
} else if (entry.isFile() && entry.name.endsWith('.md') && !EXCLUDED_BASENAMES.has(entry.name)) {
|
|
57
|
+
out.push(full);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
return out;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/** Extract the frontmatter block from a file's text as
|
|
64
|
+
* { open, block, close, index }, where `index` is the offset of `open` in
|
|
65
|
+
* `text` and `open + block + close` is the exact original frontmatter
|
|
66
|
+
* substring (delimiters included) — enough to splice a change back in
|
|
67
|
+
* without disturbing anything before or after it. Returns null if the file
|
|
68
|
+
* has no `---`-delimited frontmatter at all. */
|
|
69
|
+
function extractFrontmatter(text) {
|
|
70
|
+
const match = text.match(/^(---\r?\n)([\s\S]*?\r?\n)(---\r?\n)/);
|
|
71
|
+
if (!match) return null;
|
|
72
|
+
return { open: match[1], block: match[2], close: match[3], index: match.index };
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
function parseId(block) {
|
|
76
|
+
const match = block.match(/^id:\s*(\S+)\s*$/m);
|
|
77
|
+
return match ? match[1] : null;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
function hasAliases(block) {
|
|
81
|
+
return /^aliases:/m.test(block);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
/** Insert `aliases: [<id>]` as a new line immediately after the id: line
|
|
85
|
+
* inside the frontmatter block, preserving the file's own line-ending style.
|
|
86
|
+
* Returns the whole updated file text, or null if the id: line could not be
|
|
87
|
+
* located inside the block (should not happen once parseId succeeded, but
|
|
88
|
+
* guarded rather than assumed). */
|
|
89
|
+
function insertAliases(text, fm, id) {
|
|
90
|
+
const eol = fm.open.includes('\r\n') ? '\r\n' : '\n';
|
|
91
|
+
const newBlock = fm.block.replace(/^(id:\s*\S+\s*)$/m, (line) => `${line}${eol}aliases: [${id}]`);
|
|
92
|
+
if (newBlock === fm.block) return null;
|
|
93
|
+
const before = text.slice(0, fm.index);
|
|
94
|
+
const after = text.slice(fm.index + fm.open.length + fm.block.length + fm.close.length);
|
|
95
|
+
return `${before}${fm.open}${newBlock}${fm.close}${after}`;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
function backfillProject(projectDir) {
|
|
99
|
+
const workRoot = path.join(projectDir, 'wiki', 'work');
|
|
100
|
+
if (!fs.existsSync(workRoot)) {
|
|
101
|
+
console.log(' wiki/work/ not found — nothing to backfill.');
|
|
102
|
+
return;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
let totalUpdated = 0;
|
|
106
|
+
for (const family of FAMILIES) {
|
|
107
|
+
const files = collectMarkdownFiles(path.join(workRoot, family));
|
|
108
|
+
|
|
109
|
+
for (const file of files) {
|
|
110
|
+
let text;
|
|
111
|
+
try {
|
|
112
|
+
text = fs.readFileSync(file, 'utf8');
|
|
113
|
+
} catch (err) {
|
|
114
|
+
console.error(` Warning: could not read ${path.relative(projectDir, file)} (${err.message})`);
|
|
115
|
+
continue;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
const fm = extractFrontmatter(text);
|
|
119
|
+
if (!fm) continue; // no frontmatter — not a work-item file
|
|
120
|
+
const id = parseId(fm.block);
|
|
121
|
+
if (id === null) continue; // meta-like file with no id: — nothing to backfill
|
|
122
|
+
if (hasAliases(fm.block)) continue; // already has aliases: — idempotent skip
|
|
123
|
+
|
|
124
|
+
const next = insertAliases(text, fm, id);
|
|
125
|
+
if (next === null) {
|
|
126
|
+
console.error(` Warning: could not locate an id: line to backfill in ${path.relative(projectDir, file)}`);
|
|
127
|
+
continue;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
try {
|
|
131
|
+
fs.writeFileSync(file, next);
|
|
132
|
+
} catch (err) {
|
|
133
|
+
console.error(` Warning: could not write ${path.relative(projectDir, file)} (${err.message})`);
|
|
134
|
+
continue;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
console.log(` + aliases: [${id}] -> ${path.relative(projectDir, file)}`);
|
|
138
|
+
totalUpdated++;
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
if (totalUpdated === 0) {
|
|
143
|
+
console.log(' wiki/work/ aliases: all work-item files already up to date.');
|
|
144
|
+
} else {
|
|
145
|
+
console.log(` wiki/work/ aliases: backfilled ${totalUpdated} file${totalUpdated === 1 ? '' : 's'}.`);
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
const projectDir = process.argv[2];
|
|
150
|
+
if (!projectDir) {
|
|
151
|
+
console.error('Usage: backfill-wiki-aliases.js <path-to-project>');
|
|
152
|
+
process.exit(0); // never abort the caller over a usage slip either
|
|
153
|
+
} else {
|
|
154
|
+
try {
|
|
155
|
+
backfillProject(projectDir);
|
|
156
|
+
} catch (err) {
|
|
157
|
+
console.error(` Warning: wiki alias backfill failed unexpectedly (${err.message}) — skipping.`);
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
process.exit(0);
|
|
@@ -27,7 +27,9 @@ GLOBAL_HOOKS_DIR="$HOME/.claude/hooks"
|
|
|
27
27
|
if [ -d "$TEMPLATE_DIR/lib/hooks" ]; then
|
|
28
28
|
echo "Installing hooks globally (~/.claude/hooks/)..."
|
|
29
29
|
mkdir -p "$GLOBAL_HOOKS_DIR"
|
|
30
|
-
|
|
30
|
+
# Content-based comparison + minimal per-file report — see sync-wiki-scaffold.sh's
|
|
31
|
+
# RSYNC_FLAGS comment for why plain -av re-lists every file on every run.
|
|
32
|
+
rsync -a --checksum --omit-dir-times --out-format=' + %n' --exclude='.DS_Store' "$TEMPLATE_DIR/lib/hooks/" "$GLOBAL_HOOKS_DIR/"
|
|
31
33
|
echo ""
|
|
32
34
|
else
|
|
33
35
|
echo "Warning: $TEMPLATE_DIR/lib/hooks not found — hook scripts NOT installed" >&2
|
|
@@ -40,7 +42,7 @@ echo "Installing skills globally (~/.claude/skills/)..."
|
|
|
40
42
|
mkdir -p "$GLOBAL_SKILLS_DIR"
|
|
41
43
|
|
|
42
44
|
# Rsync skills from the template to ~/.claude/skills/
|
|
43
|
-
rsync -
|
|
45
|
+
rsync -a --checksum --omit-dir-times --out-format=' + %n' --exclude='.DS_Store' "$TEMPLATE_DIR/lib/skills/" "$GLOBAL_SKILLS_DIR/"
|
|
44
46
|
|
|
45
47
|
# Detect stale skill folders from the wiki rename
|
|
46
48
|
ORPHAN_FOUND=()
|
|
@@ -26,6 +26,24 @@ PLUGIN_GRAPH_LINK_TYPES="natefrisch01/Graph-Link-Types"
|
|
|
26
26
|
# Breadcrumbs — verify SkepticMystic/breadcrumbs is still the maintained fork
|
|
27
27
|
# at install time (vs. a community fork) before relying on this constant.
|
|
28
28
|
PLUGIN_BREADCRUMBS="SkepticMystic/breadcrumbs"
|
|
29
|
+
# Displays a note's frontmatter `title` (matching this repo's own convention
|
|
30
|
+
# on every index.md and knowledge page) in place of the bare filename across
|
|
31
|
+
# the file explorer, tabs, search, and — the reason it's bundled here — the
|
|
32
|
+
# graph view. Installed/enabled like the other three, but
|
|
33
|
+
# its own per-surface toggles (Explorer, Graph, etc.) default OFF inside the
|
|
34
|
+
# plugin's own settings and are NOT scripted here: its internal data.json
|
|
35
|
+
# settings schema is undocumented/unversioned, so hardcoding it would be the
|
|
36
|
+
# same class of silent-failure risk BUG-0011 already taught this file to
|
|
37
|
+
# avoid. See the one-time manual step noted alongside the install below.
|
|
38
|
+
PLUGIN_FRONT_MATTER_TITLE="snezhig/obsidian-front-matter-title"
|
|
39
|
+
# Patches Obsidian's link-lookup step with an alias fallback (tries real
|
|
40
|
+
# filename resolution first, then a note's `aliases:` frontmatter) — the
|
|
41
|
+
# plugin half of ROADMAP-008's wikilink-resolution fix; the `aliases:`
|
|
42
|
+
# frontmatter half is scripted elsewhere. Self-described "experimental" in
|
|
43
|
+
# its own manifest.json and less widely used than the other four bundled
|
|
44
|
+
# plugins — verify johannrichard/alias-linker is still maintained at
|
|
45
|
+
# install time before relying on this constant.
|
|
46
|
+
PLUGIN_ALIAS_LINKER="johannrichard/alias-linker"
|
|
29
47
|
|
|
30
48
|
_install_obsidian_app() {
|
|
31
49
|
local os
|
|
@@ -227,6 +245,25 @@ _enable_obsidian_plugin() {
|
|
|
227
245
|
' "$vault_dir" "$id" || true
|
|
228
246
|
}
|
|
229
247
|
|
|
248
|
+
_install_obsidian_graph_defaults() {
|
|
249
|
+
local vault_dir="$1"
|
|
250
|
+
|
|
251
|
+
if ! mkdir -p "$vault_dir/.obsidian"; then
|
|
252
|
+
echo " WARNING: failed to create $vault_dir/.obsidian — skipping graph defaults." >&2
|
|
253
|
+
return
|
|
254
|
+
fi
|
|
255
|
+
|
|
256
|
+
if [ -f "$vault_dir/.obsidian/graph.json" ]; then
|
|
257
|
+
echo " .obsidian/graph.json already present — leaving your customization in place, skipping."
|
|
258
|
+
return 0
|
|
259
|
+
fi
|
|
260
|
+
|
|
261
|
+
if ! cp "$SCRIPT_DIR/templates/obsidian/graph.json" "$vault_dir/.obsidian/graph.json"; then
|
|
262
|
+
echo " WARNING: failed to install graph defaults — skipping." >&2
|
|
263
|
+
return
|
|
264
|
+
fi
|
|
265
|
+
}
|
|
266
|
+
|
|
230
267
|
# ---------------------------------------------------------------------------
|
|
231
268
|
# App install gate
|
|
232
269
|
#
|
|
@@ -266,7 +303,7 @@ if [ -z "$PROJECT_DIR" ]; then
|
|
|
266
303
|
else
|
|
267
304
|
install_plugins=false
|
|
268
305
|
if [ "$INTERACTIVE" = true ]; then
|
|
269
|
-
if prompt_yn_sticky obsidian.plugins "$PROJECT_DIR" "Install recommended Obsidian plugins (Dataview, Graph Link Types, Breadcrumbs) into this project's vault config? [Y/n]: "; then
|
|
306
|
+
if prompt_yn_sticky obsidian.plugins "$PROJECT_DIR" "Install recommended Obsidian plugins (Dataview, Graph Link Types, Breadcrumbs, Front Matter Title, Alias Linker) into this project's vault config? [Y/n]: "; then
|
|
270
307
|
install_plugins=true
|
|
271
308
|
fi
|
|
272
309
|
else
|
|
@@ -280,7 +317,7 @@ else
|
|
|
280
317
|
fi
|
|
281
318
|
|
|
282
319
|
if [ "$install_plugins" = true ]; then
|
|
283
|
-
for plugin_repo in "$PLUGIN_DATAVIEW" "$PLUGIN_GRAPH_LINK_TYPES" "$PLUGIN_BREADCRUMBS"; do
|
|
320
|
+
for plugin_repo in "$PLUGIN_DATAVIEW" "$PLUGIN_GRAPH_LINK_TYPES" "$PLUGIN_BREADCRUMBS" "$PLUGIN_FRONT_MATTER_TITLE" "$PLUGIN_ALIAS_LINKER"; do
|
|
284
321
|
plugin_id="$(_install_obsidian_plugin "$PROJECT_DIR" "$plugin_repo")" || plugin_id=""
|
|
285
322
|
if [ -n "$plugin_id" ]; then
|
|
286
323
|
_enable_obsidian_plugin "$PROJECT_DIR" "$plugin_id" || true
|
|
@@ -288,7 +325,37 @@ else
|
|
|
288
325
|
# Empty $plugin_id means _install_obsidian_plugin already warned
|
|
289
326
|
# internally — just move on to the next plugin.
|
|
290
327
|
done
|
|
328
|
+
echo " NOTE: Front Matter Title is installed and enabled, but its per-surface display toggles default OFF inside its own settings — open Settings -> Front Matter Title in Obsidian and enable 'Graph' (and 'Explorer' if wanted) once to see frontmatter titles instead of filenames."
|
|
291
329
|
else
|
|
292
330
|
echo " Skipping Obsidian plugin install."
|
|
293
331
|
fi
|
|
294
332
|
fi
|
|
333
|
+
|
|
334
|
+
# ---------------------------------------------------------------------------
|
|
335
|
+
# Graph defaults install gate
|
|
336
|
+
#
|
|
337
|
+
# obsidian.graphDefaults is a project-scoped key — the vault root is $PROJECT_DIR,
|
|
338
|
+
# so its prompt_yn_sticky/prefs_get selector is "$PROJECT_DIR" itself (never
|
|
339
|
+
# --global), per the selector-consistency rule documented on prompt_yn_sticky
|
|
340
|
+
# in lib.sh. No $PROJECT_DIR means no vault to install into, so skip outright
|
|
341
|
+
# rather than guessing a location.
|
|
342
|
+
# ---------------------------------------------------------------------------
|
|
343
|
+
if [ -z "$PROJECT_DIR" ]; then
|
|
344
|
+
echo " WARNING: no --project-dir given — skipping Obsidian graph defaults install."
|
|
345
|
+
else
|
|
346
|
+
if [ "$INTERACTIVE" = true ]; then
|
|
347
|
+
if prompt_yn_sticky obsidian.graphDefaults "$PROJECT_DIR" "Install default graph-view styling (.obsidian/graph.json — colors wiki/knowledge and wiki/work/* by family, scopes the graph to wiki/knowledge and wiki/work only)? [Y/n]: "; then
|
|
348
|
+
_install_obsidian_graph_defaults "$PROJECT_DIR"
|
|
349
|
+
else
|
|
350
|
+
echo " Skipping Obsidian graph defaults install."
|
|
351
|
+
fi
|
|
352
|
+
else
|
|
353
|
+
# Same non-interactive mirroring as the app-install gate above, applied
|
|
354
|
+
# to the project-scoped key: only a stored `false` skips.
|
|
355
|
+
if [ "$(prefs_get obsidian.graphDefaults "$PROJECT_DIR")" = "false" ]; then
|
|
356
|
+
echo " obsidian.graphDefaults: skipped (remembered decline — change with /bootstrap-config)"
|
|
357
|
+
else
|
|
358
|
+
_install_obsidian_graph_defaults "$PROJECT_DIR"
|
|
359
|
+
fi
|
|
360
|
+
fi
|
|
361
|
+
fi
|
package/lib/scripts/lib.sh
CHANGED
|
@@ -142,10 +142,12 @@ detect_installed_mcps() {
|
|
|
142
142
|
# install-global.sh --skip-mcps), then attempt the interactive MCP install
|
|
143
143
|
# (guarded — a failure only warns and continues, it does not abort the rest
|
|
144
144
|
# of the sync), sync the wiki scaffold (tiered guide delivery — --interactive
|
|
145
|
-
# enables the optional-guide prompts), merge the .gitignore,
|
|
146
|
-
#
|
|
147
|
-
#
|
|
148
|
-
#
|
|
145
|
+
# enables the optional-guide prompts), merge the .gitignore, backfill
|
|
146
|
+
# aliases: onto any wiki/work/ file that has drifted without one (unguarded —
|
|
147
|
+
# backfill-wiki-aliases.js always exits 0 on its own, same contract as
|
|
148
|
+
# merge-settings-deny.js/merge-settings-hooks.js), build the MCP-tools guide
|
|
149
|
+
# for the detected MCPs, then bootstrap Serena's project.yml. Prints the same
|
|
150
|
+
# section headers and blank-line separators the two scripts printed inline.
|
|
149
151
|
# ---------------------------------------------------------------------------
|
|
150
152
|
run_project_sync() {
|
|
151
153
|
local project_dir script_dir installed_mcps
|
|
@@ -167,6 +169,10 @@ run_project_sync() {
|
|
|
167
169
|
"$script_dir/merge-gitignore.sh" --interactive "$project_dir"
|
|
168
170
|
echo ""
|
|
169
171
|
|
|
172
|
+
echo "Backfilling wiki work-item aliases..."
|
|
173
|
+
node "$script_dir/backfill-wiki-aliases.js" "$project_dir"
|
|
174
|
+
echo ""
|
|
175
|
+
|
|
170
176
|
echo "Checking Obsidian setup..."
|
|
171
177
|
if ! "$script_dir/install-obsidian.sh" --interactive --project-dir "$project_dir"; then
|
|
172
178
|
echo "Warning: Obsidian install failed — continuing; re-run update to retry." >&2
|
|
@@ -216,6 +222,17 @@ prompt_yn() {
|
|
|
216
222
|
fi
|
|
217
223
|
case "$reply" in
|
|
218
224
|
[yY]*) return 0 ;;
|
|
225
|
+
"")
|
|
226
|
+
# A bare Enter press honors whichever default the prompt text itself
|
|
227
|
+
# displays. Every prompt in this codebase already signals its default
|
|
228
|
+
# via bracket capitalization ("[Y/n]" vs "[y/N]") — this just makes an
|
|
229
|
+
# empty reply match what the user was shown, instead of every empty
|
|
230
|
+
# reply silently meaning "no" regardless of what the brackets promised.
|
|
231
|
+
case "$prompt" in
|
|
232
|
+
*"[Y/n]"*) return 0 ;;
|
|
233
|
+
*) return 1 ;;
|
|
234
|
+
esac
|
|
235
|
+
;;
|
|
219
236
|
*) return 1 ;;
|
|
220
237
|
esac
|
|
221
238
|
}
|
|
@@ -242,71 +242,107 @@ elif [ "$review_sections" -eq 1 ]; then
|
|
|
242
242
|
echo ".gitignore: no changes made in $PROJECT_DIR"
|
|
243
243
|
fi
|
|
244
244
|
|
|
245
|
-
# Machine-local git exclusion for bootstrap agent state
|
|
246
|
-
# go into .gitignore: Serena (ignore_all_files_in_gitignore:
|
|
247
|
-
# Code's Grep mirror .gitignore and would go blind on the wiki.
|
|
248
|
-
# has identical semantics for git, is never committed (a
|
|
249
|
-
# offered per-machine), and is invisible to Serena — its
|
|
250
|
-
# only files named ".gitignore", so the dirs stay
|
|
251
|
-
# to every tool: ripgrep-class walkers and Claude
|
|
252
|
-
# info/exclude. That is why install-global.sh
|
|
253
|
-
# and registers it as the fileSuggestion
|
|
254
|
-
# listed under the sentinel
|
|
245
|
+
# Machine-local git exclusion for bootstrap agent state and preference files.
|
|
246
|
+
# These dirs must NEVER go into .gitignore: Serena (ignore_all_files_in_gitignore:
|
|
247
|
+
# true) and Claude Code's Grep mirror .gitignore and would go blind on the wiki.
|
|
248
|
+
# .git/info/exclude has identical semantics for git, is never committed (a
|
|
249
|
+
# per-machine choice, offered per-machine), and is invisible to Serena — its
|
|
250
|
+
# GitignoreParser reads only files named ".gitignore", so the dirs stay
|
|
251
|
+
# navigable. It is NOT invisible to every tool: ripgrep-class walkers and Claude
|
|
252
|
+
# Code's @ file picker do honor info/exclude. That is why install-global.sh
|
|
253
|
+
# installs ~/.claude/file-suggestion.sh and registers it as the fileSuggestion
|
|
254
|
+
# picker — it re-includes exactly the paths listed under the sentinel below.
|
|
255
|
+
#
|
|
256
|
+
# ONE sentinel, shared by both mechanisms below (wiki/agent-state dirs and the
|
|
257
|
+
# bootstrap-prefs files), so file-suggestion.sh's single hardcoded SENTINEL
|
|
258
|
+
# always matches regardless of which mechanism ran, in which order, or which
|
|
259
|
+
# options got picked. Generic text — not "wiki", not "preferences" — because
|
|
260
|
+
# it's read back only by name, never by content.
|
|
255
261
|
GIT_EXCLUDE="$PROJECT_DIR/.git/info/exclude"
|
|
256
|
-
EXCLUDE_SENTINEL="# bootstrap
|
|
257
|
-
|
|
258
|
-
#
|
|
259
|
-
#
|
|
260
|
-
#
|
|
261
|
-
#
|
|
262
|
-
#
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
if (at + 3 < NR && line[at + 4] !~ /^[[:space:]]*#/) exit 1
|
|
275
|
-
exit 0
|
|
276
|
-
}
|
|
277
|
-
' "$1"
|
|
278
|
-
}
|
|
262
|
+
EXCLUDE_SENTINEL="# bootstrap machine-local (autocomplete-visible)"
|
|
263
|
+
|
|
264
|
+
# The sentinel text this mechanism used before the two blocks were unified.
|
|
265
|
+
# Scrubbed on sight by exclude_ensure_paths so upgrading an existing project
|
|
266
|
+
# (like one that only ever answered the prefs.gitTracking question) cleans up
|
|
267
|
+
# the stale header automatically instead of leaving two competing sentinels.
|
|
268
|
+
LEGACY_PREFS_SENTINEL="# bootstrap preferences (machine-local)"
|
|
269
|
+
|
|
270
|
+
# Every path bootstrap ever excludes here, in the fixed order they're packed
|
|
271
|
+
# into the block when present. Each is independently optional — the block can
|
|
272
|
+
# hold anywhere from zero of these (the proactive empty case) to all five.
|
|
273
|
+
KNOWN_EXCLUDE_PATHS=(".serena/" "raw/" "wiki/" ".claude/bootstrap-prefs.json" ".claude/bootstrap-prefs.README.md")
|
|
274
|
+
|
|
275
|
+
# Set by exclude_ensure_paths after every call: 1 if the file's content changed,
|
|
276
|
+
# 0 if it was already exactly the desired shape (byte-identical, left untouched
|
|
277
|
+
# — mtime and permissions included). Callers use this to decide whether a
|
|
278
|
+
# repair/no-op message is worth printing.
|
|
279
|
+
EXCLUDE_CHANGED=0
|
|
279
280
|
|
|
280
|
-
# A user's own entry sitting INSIDE the sentinel block
|
|
281
|
-
# our block at the bottom
|
|
282
|
-
#
|
|
283
|
-
# user's view of their own
|
|
281
|
+
# A user's own entry sitting INSIDE the sentinel block that isn't one of
|
|
282
|
+
# KNOWN_EXCLUDE_PATHS. exclude_ensure_paths re-appends our block at the bottom
|
|
283
|
+
# and leaves such an entry above it: git still excludes it, but the picker stops
|
|
284
|
+
# re-including it, so say so rather than change the user's view of their own
|
|
285
|
+
# file silently.
|
|
284
286
|
exclude_stranded() {
|
|
285
287
|
[ -f "$1" ] || return 0
|
|
286
|
-
|
|
288
|
+
# Space-joined, not newline-joined: BSD awk (macOS's default /usr/bin/awk)
|
|
289
|
+
# rejects a `-v` value containing an embedded newline ("newline in string").
|
|
290
|
+
# None of KNOWN_EXCLUDE_PATHS' fixed entries contain a space, so this is safe.
|
|
291
|
+
awk -v sentinel="$EXCLUDE_SENTINEL" -v known="$(printf '%s ' "${KNOWN_EXCLUDE_PATHS[@]}")" '
|
|
292
|
+
BEGIN { kc = split(known, klines, " ") }
|
|
287
293
|
$0 == sentinel { in_block = 1; next }
|
|
288
294
|
in_block && /^[[:space:]]*#/ { in_block = 0 }
|
|
289
|
-
in_block && $0 !~ /^[[:space:]]*$/
|
|
290
|
-
|
|
295
|
+
in_block && $0 !~ /^[[:space:]]*$/ {
|
|
296
|
+
is_known = 0
|
|
297
|
+
for (i = 1; i <= kc; i++) if ($0 == klines[i]) { is_known = 1; break }
|
|
298
|
+
if (!is_known) print " " $0
|
|
299
|
+
}
|
|
291
300
|
' "$1"
|
|
292
301
|
}
|
|
293
302
|
|
|
294
|
-
#
|
|
295
|
-
#
|
|
296
|
-
#
|
|
297
|
-
#
|
|
298
|
-
#
|
|
299
|
-
|
|
300
|
-
|
|
303
|
+
# exclude_ensure_paths <file> [path...]: idempotently ensure the sentinel is
|
|
304
|
+
# present in <file> exactly once, immediately followed by every
|
|
305
|
+
# KNOWN_EXCLUDE_PATHS entry that is either already anywhere in the file (so a
|
|
306
|
+
# prior run's, or the other mechanism's, entries survive) or passed as an
|
|
307
|
+
# argument here — packed in KNOWN_EXCLUDE_PATHS order, terminated by a "#"
|
|
308
|
+
# comment or EOF. Everything else in the file survives verbatim and in its
|
|
309
|
+
# original relative order (this file may hold the user's own exclusions); the
|
|
310
|
+
# legacy pre-unification header is scrubbed on sight. A file already in exactly
|
|
311
|
+
# this shape is left byte-identical (EXCLUDE_CHANGED=0) so repeated/no-op calls
|
|
312
|
+
# never show up as a diff.
|
|
313
|
+
exclude_ensure_paths() {
|
|
314
|
+
local file="$1"; shift
|
|
315
|
+
local src="$file" tmp mode="" p a
|
|
316
|
+
local want=()
|
|
301
317
|
[ -f "$src" ] || src=/dev/null
|
|
318
|
+
|
|
319
|
+
for p in "${KNOWN_EXCLUDE_PATHS[@]}"; do
|
|
320
|
+
if [ -f "$src" ] && grep -qFx -- "$p" "$src"; then
|
|
321
|
+
want+=("$p")
|
|
322
|
+
continue
|
|
323
|
+
fi
|
|
324
|
+
for a in "$@"; do
|
|
325
|
+
if [ "$a" = "$p" ]; then want+=("$p"); break; fi
|
|
326
|
+
done
|
|
327
|
+
done
|
|
328
|
+
|
|
302
329
|
if [ -f "$file" ]; then
|
|
303
330
|
mode=$(stat -f '%Lp' "$file" 2>/dev/null || stat -c '%a' "$file" 2>/dev/null || true)
|
|
304
331
|
fi
|
|
305
332
|
mkdir -p "$(dirname "$file")" || return 1
|
|
306
333
|
tmp=$(mktemp "$(dirname "$file")/.bootstrap-exclude.XXXXXX") || return 1
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
334
|
+
# Space-joined, not newline-joined: BSD awk (macOS's default /usr/bin/awk)
|
|
335
|
+
# rejects a `-v` value containing an embedded newline ("newline in string").
|
|
336
|
+
# `want` only ever holds entries from the fixed, space-free KNOWN_EXCLUDE_PATHS.
|
|
337
|
+
awk -v sentinel="$EXCLUDE_SENTINEL" -v legacy="$LEGACY_PREFS_SENTINEL" \
|
|
338
|
+
-v wanted="$(printf '%s ' ${want[@]+"${want[@]}"})" '
|
|
339
|
+
BEGIN { n = 0; prev_blank = 1; dropped = 0; wc = split(wanted, wlines, " ") }
|
|
340
|
+
$0 == sentinel || $0 == legacy { dropped = 1; next }
|
|
341
|
+
{
|
|
342
|
+
is_known = 0
|
|
343
|
+
for (i = 1; i <= wc; i++) if (wlines[i] != "" && $0 == wlines[i]) { is_known = 1; break }
|
|
344
|
+
}
|
|
345
|
+
is_known { dropped = 1; next }
|
|
310
346
|
{
|
|
311
347
|
if ($0 ~ /^[[:space:]]*$/) {
|
|
312
348
|
if (prev_blank && dropped) next
|
|
@@ -322,23 +358,29 @@ exclude_normalize() {
|
|
|
322
358
|
if (n == 1 && keep[1] ~ /^[[:space:]]*$/) n = 0
|
|
323
359
|
for (i = 1; i <= n; i++) print keep[i]
|
|
324
360
|
print sentinel
|
|
325
|
-
|
|
326
|
-
print "raw/"
|
|
327
|
-
print "wiki/"
|
|
361
|
+
for (i = 1; i <= wc; i++) if (wlines[i] != "") print wlines[i]
|
|
328
362
|
}
|
|
329
363
|
' "$src" > "$tmp" || { rm -f "$tmp"; return 1; }
|
|
364
|
+
|
|
365
|
+
if [ -f "$file" ] && cmp -s "$file" "$tmp"; then
|
|
366
|
+
rm -f "$tmp"
|
|
367
|
+
EXCLUDE_CHANGED=0
|
|
368
|
+
return 0
|
|
369
|
+
fi
|
|
330
370
|
mv -f "$tmp" "$file" || { rm -f "$tmp"; return 1; }
|
|
331
371
|
if [ -n "$mode" ]; then chmod "$mode" "$file" 2>/dev/null || true; fi
|
|
372
|
+
EXCLUDE_CHANGED=1
|
|
332
373
|
return 0
|
|
333
374
|
}
|
|
334
375
|
|
|
335
376
|
# Normalize and report. Never fatal: this runs under `set -euo pipefail` from
|
|
336
377
|
# run_project_sync and must not abort the user's setup.
|
|
337
378
|
exclude_apply() {
|
|
379
|
+
local file="$1"; shift
|
|
338
380
|
local stranded
|
|
339
|
-
stranded=$(exclude_stranded "$
|
|
340
|
-
if !
|
|
341
|
-
echo " Warning: could not update $
|
|
381
|
+
stranded=$(exclude_stranded "$file")
|
|
382
|
+
if ! exclude_ensure_paths "$file" "$@"; then
|
|
383
|
+
echo " Warning: could not update $file — left unchanged."
|
|
342
384
|
return 1
|
|
343
385
|
fi
|
|
344
386
|
if [ -n "$stranded" ]; then
|
|
@@ -349,7 +391,30 @@ exclude_apply() {
|
|
|
349
391
|
return 0
|
|
350
392
|
}
|
|
351
393
|
|
|
394
|
+
# Guarantees the shared sentinel exists even if nothing is excluded yet, so any
|
|
395
|
+
# bootstrap feature — this run or a future one — always finds the same anchor
|
|
396
|
+
# regardless of which of the prompts below get accepted or declined. A bare
|
|
397
|
+
# comment line excludes nothing, so writing it needs no consent prompt. Stays
|
|
398
|
+
# quiet unless this call is what introduces the sentinel for the very first
|
|
399
|
+
# time on a file with no bootstrap-managed paths yet — otherwise the branches
|
|
400
|
+
# below describe whatever they changed themselves.
|
|
401
|
+
exclude_ensure_sentinel() {
|
|
402
|
+
local file="$1" had_sentinel=false had_known=false p
|
|
403
|
+
if [ -f "$file" ]; then
|
|
404
|
+
grep -qFx -- "$EXCLUDE_SENTINEL" "$file" 2>/dev/null && had_sentinel=true
|
|
405
|
+
for p in "${KNOWN_EXCLUDE_PATHS[@]}"; do
|
|
406
|
+
grep -qFx -- "$p" "$file" 2>/dev/null && { had_known=true; break; }
|
|
407
|
+
done
|
|
408
|
+
fi
|
|
409
|
+
exclude_apply "$file" || return 0
|
|
410
|
+
if [ "$EXCLUDE_CHANGED" -eq 1 ] && [ "$had_sentinel" = false ] && [ "$had_known" = false ]; then
|
|
411
|
+
echo " .git/info/exclude: added shared bootstrap sentinel (machine-local; nothing excluded yet)"
|
|
412
|
+
fi
|
|
413
|
+
}
|
|
414
|
+
|
|
352
415
|
if [ -d "$PROJECT_DIR/.git" ]; then
|
|
416
|
+
exclude_ensure_sentinel "$GIT_EXCLUDE"
|
|
417
|
+
|
|
353
418
|
exclude_missing=0
|
|
354
419
|
exclude_added=""
|
|
355
420
|
for p in ".serena/" "raw/" "wiki/"; do
|
|
@@ -360,21 +425,20 @@ if [ -d "$PROJECT_DIR/.git" ]; then
|
|
|
360
425
|
exclude_added="${exclude_added} + ${p} (.git/info/exclude)"$'\n'
|
|
361
426
|
done
|
|
362
427
|
|
|
363
|
-
if
|
|
364
|
-
: # already canonical — leave the file byte-identical
|
|
365
|
-
elif [ "$exclude_missing" -gt 0 ]; then
|
|
428
|
+
if [ "$exclude_missing" -gt 0 ]; then
|
|
366
429
|
# Accepting newly hides paths from git, so this stays a consent prompt.
|
|
367
430
|
#
|
|
368
431
|
# `gitignore.infoExclude` is declines-only: a decline records `false` and
|
|
369
432
|
# suppresses the re-offer, an accept records NOTHING, because accepting
|
|
370
|
-
# changes the world and
|
|
371
|
-
# sticky. Keep this key distinct from
|
|
372
|
-
# .gitignore section pass) and
|
|
373
|
-
# themselves) — declining one must
|
|
433
|
+
# changes the world and exclude_ensure_paths's byte-identical no-op above
|
|
434
|
+
# already makes it sticky. Keep this key distinct from
|
|
435
|
+
# `gitignore.offerSectionUpdates` (the .gitignore section pass) and
|
|
436
|
+
# `prefs.gitTracking` (the preference files themselves) — declining one must
|
|
437
|
+
# never disable another.
|
|
374
438
|
if [ "$(prefs_get gitignore.infoExclude "$PROJECT_DIR")" = "false" ]; then
|
|
375
439
|
echo " .git/info/exclude: skipped (remembered answer gitignore.infoExclude=false — change with /bootstrap-config)."
|
|
376
|
-
elif prompt_yn "
|
|
377
|
-
if exclude_apply; then
|
|
440
|
+
elif prompt_yn " Add .serena/, raw/, and wiki/ to git's local ignore list (.git/info/exclude, this machine only)? [y/N]: "; then
|
|
441
|
+
if exclude_apply "$GIT_EXCLUDE" ".serena/" "raw/" "wiki/"; then
|
|
378
442
|
printf '%s' "$exclude_added"
|
|
379
443
|
echo " Note: this protects only this clone — teammates opt in by running 'npx @codewizard-dt/bootstrap update' themselves."
|
|
380
444
|
fi
|
|
@@ -386,7 +450,9 @@ if [ -d "$PROJECT_DIR/.git" ]; then
|
|
|
386
450
|
# not change, only the picker's view of it. A pure repair, so no prompt —
|
|
387
451
|
# deliberately regardless of the stored `gitignore.infoExclude` value, since
|
|
388
452
|
# a decline refuses newly hiding paths, not repairing a sentinel.
|
|
389
|
-
|
|
453
|
+
# exclude_apply is a byte-identical no-op when the block is already
|
|
454
|
+
# canonical, so EXCLUDE_CHANGED gates the message.
|
|
455
|
+
if exclude_apply "$GIT_EXCLUDE" ".serena/" "raw/" "wiki/" && [ "$EXCLUDE_CHANGED" -eq 1 ]; then
|
|
390
456
|
echo " .git/info/exclude: reordered .serena/, raw/, wiki/ under the bootstrap sentinel (git unchanged; restores @-autocomplete)"
|
|
391
457
|
fi
|
|
392
458
|
fi
|
|
@@ -466,42 +532,33 @@ if has_tty; then
|
|
|
466
532
|
echo " .git/info/exclude: $PROJECT_DIR is not a git repository — nothing to exclude; the preference files stay visible to git."
|
|
467
533
|
else
|
|
468
534
|
prefs_written=0
|
|
535
|
+
prefs_added=""
|
|
469
536
|
for p in "$PREFS_VALUES_PATH" "$PREFS_README_PATH"; do
|
|
470
537
|
if [ -f "$GIT_EXCLUDE" ] && grep -qFx -- "$p" "$GIT_EXCLUDE"; then
|
|
471
538
|
continue
|
|
472
539
|
fi
|
|
540
|
+
prefs_written=$((prefs_written + 1))
|
|
541
|
+
prefs_added="${prefs_added} + ${p} (.git/info/exclude)"$'\n'
|
|
542
|
+
done
|
|
543
|
+
# Same shared sentinel and merge function the wiki-dirs block above
|
|
544
|
+
# uses — both mechanisms converge on one block so file-suggestion.sh's
|
|
545
|
+
# single hardcoded SENTINEL always matches, regardless of which of the
|
|
546
|
+
# two ran first or which options were chosen. exclude_ensure_paths only
|
|
547
|
+
# adds paths it's asked for (or that were already present), so this
|
|
548
|
+
# never force-adds .serena/, raw/, or wiki/ for a user who declined
|
|
549
|
+
# that separately — and it scrubs the legacy pre-unification header on
|
|
550
|
+
# sight if this project still has it.
|
|
551
|
+
if exclude_apply "$GIT_EXCLUDE" "$PREFS_VALUES_PATH" "$PREFS_README_PATH"; then
|
|
473
552
|
if [ "$prefs_written" -eq 0 ]; then
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
553
|
+
if [ "$EXCLUDE_CHANGED" -eq 1 ]; then
|
|
554
|
+
echo " .git/info/exclude: already excludes the bootstrap preference files (repositioned under the shared bootstrap sentinel)."
|
|
555
|
+
else
|
|
556
|
+
echo " .git/info/exclude: already excludes the bootstrap preference files."
|
|
477
557
|
fi
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
# what exclude_is_canonical accepts as the block terminator; and
|
|
482
|
-
# exclude_stranded stops scanning at the first "#", so our entries
|
|
483
|
-
# are never reported as stranded inside the bootstrap block.
|
|
484
|
-
printf '# bootstrap preferences (machine-local)\n' >> "$GIT_EXCLUDE"
|
|
558
|
+
else
|
|
559
|
+
printf '%s' "$prefs_added"
|
|
560
|
+
echo " Note: this hides them on THIS machine only — teammates are unaffected."
|
|
485
561
|
fi
|
|
486
|
-
printf '%s\n' "$p" >> "$GIT_EXCLUDE"
|
|
487
|
-
echo " + $p (.git/info/exclude)"
|
|
488
|
-
prefs_written=$((prefs_written + 1))
|
|
489
|
-
done
|
|
490
|
-
if [ "$prefs_written" -eq 0 ]; then
|
|
491
|
-
echo " .git/info/exclude: already excludes the bootstrap preference files."
|
|
492
|
-
else
|
|
493
|
-
echo " Note: this hides them on THIS machine only — teammates are unaffected."
|
|
494
|
-
fi
|
|
495
|
-
# Verify rather than trust: a file left non-canonical is silently
|
|
496
|
-
# rewritten by exclude_normalize on every future run. Repair ONLY when
|
|
497
|
-
# the sentinel is already present — exclude_apply would otherwise create
|
|
498
|
-
# the block and hide .serena/, raw/, wiki/ from a user who just declined
|
|
499
|
-
# exactly that above. A later normalize pass leaves our lines intact,
|
|
500
|
-
# because its scrub only removes the sentinel and those three paths.
|
|
501
|
-
if [ -f "$GIT_EXCLUDE" ] \
|
|
502
|
-
&& grep -qFx -- "$EXCLUDE_SENTINEL" "$GIT_EXCLUDE" \
|
|
503
|
-
&& ! exclude_is_canonical "$GIT_EXCLUDE"; then
|
|
504
|
-
exclude_apply || true
|
|
505
562
|
fi
|
|
506
563
|
fi
|
|
507
564
|
;;
|
|
@@ -75,7 +75,7 @@ fi
|
|
|
75
75
|
# the topology the scaffolded CI implements. Landed before the Claude run so
|
|
76
76
|
# it survives a timeout.
|
|
77
77
|
mkdir -p "$PROJECT_DIR/wiki/guides"
|
|
78
|
-
rsync -
|
|
78
|
+
rsync -a --checksum --out-format=' + %n' "$GUIDE" "$PROJECT_DIR/wiki/guides/deployment-strategy.md"
|
|
79
79
|
|
|
80
80
|
TASK="$(sed "s|__PROJECT_DIR__|$PROJECT_DIR|g" "$TEMPLATE")"
|
|
81
81
|
|
|
@@ -45,19 +45,26 @@ mkdir -p \
|
|
|
45
45
|
"$PROJECT_DIR/wiki/work/bugs" \
|
|
46
46
|
"$PROJECT_DIR/wiki/guides"
|
|
47
47
|
|
|
48
|
+
# rsync flags shared by every call below: content-based comparison (not
|
|
49
|
+
# mtime — each `npx` run extracts a fresh package copy with new mtimes, which
|
|
50
|
+
# would otherwise make every file look "changed" on every run), no directory
|
|
51
|
+
# mtime writes (same reason, applied to directories), and a minimal one-line
|
|
52
|
+
# report per file actually transferred instead of the full recursive listing.
|
|
53
|
+
RSYNC_FLAGS=(-a --checksum --omit-dir-times --out-format=' + %n')
|
|
54
|
+
|
|
48
55
|
# 2. COPY-ONCE: index.md, log.md, hot.md, .gitkeep files — project-owned after creation, never overwrite
|
|
49
56
|
# Exclude conventions.md and lifecycle.md (those are always-refresh, handled in step 3).
|
|
50
|
-
rsync
|
|
57
|
+
rsync "${RSYNC_FLAGS[@]}" --ignore-existing \
|
|
51
58
|
--exclude 'conventions.md' \
|
|
52
59
|
--exclude 'lifecycle.md' \
|
|
53
60
|
--exclude 'dashboard.html' \
|
|
54
61
|
"$TEMPLATES/" "$PROJECT_DIR/wiki/"
|
|
55
62
|
|
|
56
63
|
# 3. ALWAYS-REFRESH: spec docs (conventions.md, lifecycle.md) and dashboard.html that remain template-owned; always overwrite
|
|
57
|
-
rsync
|
|
58
|
-
rsync
|
|
64
|
+
rsync "${RSYNC_FLAGS[@]}" "$TEMPLATES/conventions.md" "$PROJECT_DIR/wiki/conventions.md"
|
|
65
|
+
rsync "${RSYNC_FLAGS[@]}" "$TEMPLATES/dashboard.html" "$PROJECT_DIR/wiki/dashboard.html"
|
|
59
66
|
for fam in requirements decisions roadmaps tasks uat bugs; do
|
|
60
|
-
rsync
|
|
67
|
+
rsync "${RSYNC_FLAGS[@]}" "$TEMPLATES/work/$fam/lifecycle.md" "$PROJECT_DIR/wiki/work/$fam/lifecycle.md"
|
|
61
68
|
done
|
|
62
69
|
|
|
63
70
|
# 4. GUIDES: tiered delivery into target wiki/guides/ (template-owned
|
|
@@ -83,9 +90,9 @@ OPTIONAL_GUIDES="evals-framework.md type-checking-templates"
|
|
|
83
90
|
deliver_guide() {
|
|
84
91
|
# $1 = guide name (file or dir under GUIDES_SRC)
|
|
85
92
|
if [ -d "$GUIDES_SRC/$1" ]; then
|
|
86
|
-
rsync
|
|
93
|
+
rsync "${RSYNC_FLAGS[@]}" "$GUIDES_SRC/$1/" "$GUIDES_DST/$1/"
|
|
87
94
|
else
|
|
88
|
-
rsync
|
|
95
|
+
rsync "${RSYNC_FLAGS[@]}" "$GUIDES_SRC/$1" "$GUIDES_DST/"
|
|
89
96
|
fi
|
|
90
97
|
}
|
|
91
98
|
|
|
@@ -47,8 +47,8 @@
|
|
|
47
47
|
"gitignore.infoExclude": {
|
|
48
48
|
"scope": "project",
|
|
49
49
|
"consumer": "installer",
|
|
50
|
-
"summary": "
|
|
51
|
-
"detail": "Asked by merge-gitignore.sh:
|
|
50
|
+
"summary": "Add .serena/, raw/, and wiki/ to git's local ignore list via .git/info/exclude",
|
|
51
|
+
"detail": "Asked by merge-gitignore.sh:440 when one or more of .serena/, raw/, wiki/ are not yet excluded. true writes them under the bootstrap sentinel in .git/info/exclude — machine-local, never committed, and unlike .gitignore it does not blind Serena or ripgrep-class walkers; the installed fileSuggestion script restores @-autocomplete for those paths. false leaves git tracking them here; teammates opt in separately by running update themselves. This is INDEPENDENT of the .gitignore section pass governed by gitignore.offerSectionUpdates: declining or disabling sections never disables the info/exclude mechanism, and a pure sentinel repair (all three already excluded elsewhere in the file) runs with no prompt at all regardless of this key. See also prefs.gitTracking, which decides how git treats the preferences file itself — a different question from these three directories.",
|
|
52
52
|
"values": "true | false",
|
|
53
53
|
"default": null,
|
|
54
54
|
"askedBy": "merge-gitignore.sh"
|
|
@@ -66,7 +66,7 @@
|
|
|
66
66
|
"scope": "project",
|
|
67
67
|
"consumer": "installer",
|
|
68
68
|
"summary": "Install a specific optional guide into wiki/guides/",
|
|
69
|
-
"detail": "One key per entry in sync-wiki-scaffold.sh's OPTIONAL_GUIDES list (sync-wiki-scaffold.sh:
|
|
69
|
+
"detail": "One key per entry in sync-wiki-scaffold.sh's OPTIONAL_GUIDES list (sync-wiki-scaffold.sh:88), keyed by the exact entry text including any extension — today that is guides.evals-framework.md and guides.type-checking-templates. true delivers the guide into wiki/guides/ on every run; false keeps it out and suppresses the per-run prompt. A guide already present in wiki/guides/ (or in the legacy .docs/guides/) is refreshed regardless of this key — existing opt-in wins, because the file on disk is the stronger signal than a stored answer. The required guide tier is never gated by these keys.",
|
|
70
70
|
"values": "true | false",
|
|
71
71
|
"default": null,
|
|
72
72
|
"askedBy": "sync-wiki-scaffold.sh",
|
|
@@ -104,7 +104,7 @@
|
|
|
104
104
|
"scope": "global",
|
|
105
105
|
"consumer": "installer",
|
|
106
106
|
"summary": "Registration scope for the Context7 MCP",
|
|
107
|
-
"detail": "Asked by prompt_scope in lib.sh:
|
|
107
|
+
"detail": "Asked by prompt_scope in lib.sh:410 ('Scope for context7 — [u]ser (default) or [p]roject?'). prompt_scope emits exactly two answers, 'user' and 'project' — it has no local-scope branch, and any reply that does not begin with p or P falls through to user. 'user' registers Context7 once for every project on this machine; 'project' writes the registration into the current project's shareable .mcp.json.",
|
|
108
108
|
"values": "user | project",
|
|
109
109
|
"default": null,
|
|
110
110
|
"askedBy": "lib.sh"
|
|
@@ -130,8 +130,17 @@
|
|
|
130
130
|
"obsidian.plugins": {
|
|
131
131
|
"scope": "project",
|
|
132
132
|
"consumer": "installer",
|
|
133
|
-
"summary": "Install the bundled Obsidian plugin set (Dataview, Graph Link Types, Breadcrumbs)",
|
|
134
|
-
"detail": "Asked by install-obsidian.sh. This is a single bundled prompt covering all
|
|
133
|
+
"summary": "Install the bundled Obsidian plugin set (Dataview, Graph Link Types, Breadcrumbs, Front Matter Title, Alias Linker)",
|
|
134
|
+
"detail": "Asked by install-obsidian.sh. This is a single bundled prompt covering all five recommended community plugins together rather than one key per plugin. Dataview is a hard prerequisite for Graph Link Types and Breadcrumbs specifically — both read fields that Dataview indexes, so installing them separately would let a user accept one without Dataview and end up with a plugin that silently doesn't work. Front Matter Title has no such dependency (it reads frontmatter directly); it is bundled here purely for prompt-count simplicity, not because it needs Dataview. Alias Linker likewise has no Dataview dependency — it patches Obsidian's core link resolver directly rather than reading Dataview-indexed fields — but it is self-described 'experimental' upstream, and that experimental status is the reason it stays bundled under this same single consent gate rather than being broken out into its own key, consistent with Front Matter Title's 'bundled here purely for prompt-count simplicity' framing above. true installs and refreshes all five plugin folders into .obsidian/plugins/ and enables them in .obsidian/community-plugins.json on every run. false means the installer stops offering the bundle again until the key is changed or removed via /bootstrap-config. Plugin files live inside this project's own .obsidian/ directory, which is why this key is project scope, matching guides.*'s scope choice. Note: Front Matter Title's own per-surface display toggles (Graph, Explorer, etc.) default OFF inside its own settings and are not scripted by this installer — see install-obsidian.sh's printed note for the one-time manual step.",
|
|
135
|
+
"values": "true | false",
|
|
136
|
+
"default": null,
|
|
137
|
+
"askedBy": "install-obsidian.sh"
|
|
138
|
+
},
|
|
139
|
+
"obsidian.graphDefaults": {
|
|
140
|
+
"scope": "project",
|
|
141
|
+
"consumer": "installer",
|
|
142
|
+
"summary": "Install default graph-view styling (.obsidian/graph.json)",
|
|
143
|
+
"detail": "Asked by install-obsidian.sh. true installs and refreshes .obsidian/graph.json with default graph-view styling if the file is absent; false means the installer stops offering it until the key is changed or removed via /bootstrap-config. This preference is independent of obsidian.plugins — accepting or declining one has no effect on the other. The file lives inside this project's own .obsidian/ directory, which is why this key is project scope, matching obsidian.plugins's scope choice.",
|
|
135
144
|
"values": "true | false",
|
|
136
145
|
"default": null,
|
|
137
146
|
"askedBy": "install-obsidian.sh"
|
|
@@ -140,7 +149,7 @@
|
|
|
140
149
|
"scope": "global",
|
|
141
150
|
"consumer": "installer",
|
|
142
151
|
"summary": "Delete stale skill folders in ~/.claude/skills/ left by the wiki rename",
|
|
143
|
-
"detail": "Asked by install-global.sh:
|
|
152
|
+
"detail": "Asked by install-global.sh:72 when any renamed-away skill folder (the adr-* and prd-* families) is still present in ~/.claude/skills/. true removes those folders with rm -rf; false keeps them, and they continue to appear as duplicate slash commands alongside their renamed replacements. The list of orphan names is fixed in the script — this key does not decide which folders qualify, only whether the deletion runs.",
|
|
144
153
|
"values": "true | false",
|
|
145
154
|
"default": null,
|
|
146
155
|
"askedBy": "install-global.sh"
|
|
@@ -7,9 +7,16 @@
|
|
|
7
7
|
# .git/info/exclude (and recent versions suggest only git-tracked files), so the
|
|
8
8
|
# machine-local excludes written by merge-gitignore.sh blind @-autocomplete on
|
|
9
9
|
# .serena/, raw/, and wiki/. This script re-includes exactly the paths listed
|
|
10
|
-
# under the bootstrap sentinel in .git/info/exclude — a user's other
|
|
11
|
-
# hidden entries stay hidden, and a project with no sentinel block
|
|
12
|
-
# `rg --files` behaviour.
|
|
10
|
+
# under the ONE shared bootstrap sentinel in .git/info/exclude — a user's other
|
|
11
|
+
# deliberately hidden entries stay hidden, and a project with no sentinel block
|
|
12
|
+
# gets plain `rg --files` behaviour. merge-gitignore.sh writes every
|
|
13
|
+
# machine-local exclusion it manages (wiki/agent-state dirs AND the
|
|
14
|
+
# bootstrap-prefs files) under this same sentinel, regardless of which of its
|
|
15
|
+
# prompts got answered or in what order — but re-inclusion below only ever
|
|
16
|
+
# checks `-d`, so of those, only the directories (.serena/, raw/, wiki/) come
|
|
17
|
+
# back in suggestions; the bootstrap-prefs files are plain files and are
|
|
18
|
+
# silently skipped, staying git-excluded but @-invisible. That's intentional,
|
|
19
|
+
# not a bug.
|
|
13
20
|
#
|
|
14
21
|
# Contract (community-verified; not fully spelled out in the settings docs):
|
|
15
22
|
# stdin JSON object with a "query" field
|
|
@@ -23,7 +30,7 @@
|
|
|
23
30
|
# stdout only, and stray stderr is visible noise on every keystroke.
|
|
24
31
|
exec 2>/dev/null
|
|
25
32
|
|
|
26
|
-
SENTINEL='# bootstrap
|
|
33
|
+
SENTINEL='# bootstrap machine-local (autocomplete-visible)'
|
|
27
34
|
MAX_RESULTS=15
|
|
28
35
|
|
|
29
36
|
# --- query -------------------------------------------------------------------
|
|
@@ -58,7 +65,8 @@ list_base() {
|
|
|
58
65
|
|
|
59
66
|
# --- sentinel-scoped re-inclusion -------------------------------------------
|
|
60
67
|
# Emit the lines between the bootstrap sentinel comment and the next comment
|
|
61
|
-
# line (or EOF) in .git/info/exclude — expected values are .serena/, raw/,
|
|
68
|
+
# line (or EOF) in .git/info/exclude — expected values are .serena/, raw/,
|
|
69
|
+
# wiki/, and (skipped below by the `-d` check) the two bootstrap-prefs files.
|
|
62
70
|
sentinel_entries() {
|
|
63
71
|
[ -f .git/info/exclude ] || return 0
|
|
64
72
|
awk -v sentinel="$SENTINEL" '
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
{
|
|
2
|
+
"search": "(path:wiki/knowledge OR path:wiki/work) -path:lifecycle.md",
|
|
3
|
+
"colorGroups": [
|
|
4
|
+
{"query": "path:wiki/knowledge/sources", "color": {"a": 1, "rgb": 9484520}},
|
|
5
|
+
{"query": "path:wiki/knowledge/concepts", "color": {"a": 1, "rgb": 5935062}},
|
|
6
|
+
{"query": "path:wiki/knowledge/entities", "color": {"a": 1, "rgb": 3104680}},
|
|
7
|
+
{"query": "path:wiki/work/tasks", "color": {"a": 1, "rgb": 15906891}},
|
|
8
|
+
{"query": "path:wiki/work/bugs", "color": {"a": 1, "rgb": 14839866}},
|
|
9
|
+
{"query": "path:wiki/work/decisions", "color": {"a": 1, "rgb": 13930827}},
|
|
10
|
+
{"query": "path:wiki/work/roadmaps", "color": {"a": 1, "rgb": 13202990}},
|
|
11
|
+
{"query": "path:wiki/work/requirements", "color": {"a": 1, "rgb": 15243100}},
|
|
12
|
+
{"query": "path:wiki/work/uat", "color": {"a": 1, "rgb": 12082238}}
|
|
13
|
+
],
|
|
14
|
+
"collapse-filter": false,
|
|
15
|
+
"showTags": true,
|
|
16
|
+
"showAttachments": false,
|
|
17
|
+
"hideUnresolved": false,
|
|
18
|
+
"showOrphans": true,
|
|
19
|
+
"collapse-color-groups": false,
|
|
20
|
+
"collapse-display": false,
|
|
21
|
+
"showArrow": false,
|
|
22
|
+
"collapse-forces": false
|
|
23
|
+
}
|
|
@@ -29,9 +29,15 @@ Bootstrap remembers your answers to installer and skill prompts in two flat JSON
|
|
|
29
29
|
|
|
30
30
|
## Step A — Locate the helper, the schema, and the layers
|
|
31
31
|
|
|
32
|
-
1. Resolve the helper path.
|
|
32
|
+
1. Resolve the helper path. There are exactly two valid locations — never search anywhere else, and never search under a project's own `lib/scripts/` (that path exists only inside the bootstrap-claude source repo checkout itself, never in a project that merely installed it):
|
|
33
|
+
- **If the current project is this bootstrap-claude repo itself** (dev checkout — `lib/scripts/bootstrap-prefs.js` exists relative to the project root): use that repo-local copy.
|
|
34
|
+
- **Otherwise (any installed/target project, the common case):** the helper lives at the fixed, project-independent path `~/.claude/bootstrap-prefs.js`, installed there by `install-global.sh` precisely so it's reachable from arbitrary projects. Use that path directly — do not `ls`/`find` for it first.
|
|
35
|
+
- If neither location has the file, abort with this exact message and stop:
|
|
33
36
|
> No bootstrap preference helper found. Run `npx @codewizard-dt/bootstrap update` (or `./lib/scripts/install-global.sh --skip-mcps`) to install it, then re-run `/bootstrap-config`.
|
|
34
|
-
2. Resolve the schema path
|
|
37
|
+
2. Resolve the schema path — it is **not** beside the helper when installed:
|
|
38
|
+
- Repo-local case: `lib/scripts/templates/bootstrap-prefs-schema.json`.
|
|
39
|
+
- Installed case: `~/.claude/templates/bootstrap-prefs-schema.json`. (The helper resolves the schema as `<its own dir>/templates/...`, and the installer deliberately places it there — see `install-global.sh`'s step 6 comment.)
|
|
40
|
+
The helper already defaults to the path matching its own location, so pass `--schema <path>` **only** when a non-default schema was located.
|
|
35
41
|
3. Determine `PROJECT_DIR` — the current working directory when inside a git repo / project, otherwise none. Record whether each layer's file exists:
|
|
36
42
|
- project layer: `<PROJECT_DIR>/.claude/bootstrap-prefs.json`
|
|
37
43
|
- global layer: `~/.claude/bootstrap-prefs.json`
|
|
@@ -87,6 +87,7 @@ Use `Write` to create `wiki/work/bugs/NNNN-<slug>.md`, following the frontmatter
|
|
|
87
87
|
- `linked_task:` — `"[[TASK-NNN]]"` if a task was mentioned (normalized from either `TASK-NNN` or `[[TASK-NNN]]` input); `"—"` otherwise
|
|
88
88
|
- `Reported`: today's date (`YYYY-MM-DD`)
|
|
89
89
|
- `Last updated`: today's date
|
|
90
|
+
- `aliases: [BUG-NNNN]` — mirrors this file's own id: field so Obsidian's wikilink resolver can find it by short ID (ROADMAP-008)
|
|
90
91
|
- Leave `Root Cause Analysis`, `Resolution`, and `Related` sections present but empty (the templated placeholder line under each `>` quote is fine)
|
|
91
92
|
|
|
92
93
|
### Step 7: Update the Bug Index
|
|
@@ -81,6 +81,11 @@ Group members may share evidence sources (Shared Context), but each block needs
|
|
|
81
81
|
Write to `wiki/work/decisions/DEC-NNNN-<group-slug>.md` using this template. **Tables only, mermaid for flows** — mandatory in every block.
|
|
82
82
|
|
|
83
83
|
````markdown
|
|
84
|
+
---
|
|
85
|
+
id: DEC-NNNN
|
|
86
|
+
aliases: [DEC-NNNN]
|
|
87
|
+
---
|
|
88
|
+
|
|
84
89
|
# DEC-NNNN: <Decision-Group Title>
|
|
85
90
|
|
|
86
91
|
> Decision Group covering <area-1>, <area-2>, <area-3>.
|
|
@@ -133,6 +133,7 @@ Use `Write` to create `wiki/work/roadmaps/NNN-slug.md` following the field table
|
|
|
133
133
|
| Field | Value at creation time |
|
|
134
134
|
|-------|------------------------|
|
|
135
135
|
| `Status` | `active` |
|
|
136
|
+
| `aliases` | `[ROADMAP-NNN]` — mirrors the file's own `id:` value |
|
|
136
137
|
| `Created` | Today's date (derive at runtime — use the conversation environment's `currentDate`, otherwise `date +%Y-%m-%d`) |
|
|
137
138
|
| `Last updated` | Same as `Created` |
|
|
138
139
|
| `Owner` | From Step 3 #3 |
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@codewizard-dt/bootstrap",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.23.0",
|
|
4
4
|
"description": "Bootstrap Claude Code projects with an LLM Wiki, reusable skills, hooks, and MCP setup",
|
|
5
5
|
"homepage": "https://github.com/codewizard-dt/bootstrap-wiki#readme",
|
|
6
6
|
"bugs": {
|