@dotdrelle/wiki-manager 0.15.42 → 0.15.48
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +139 -27
- package/mcp.endpoints.example.json +1 -1
- package/package.json +2 -2
- package/src/agent/graph.js +290 -29
- package/src/agent/graph.test.js +551 -1
- package/src/agent/skillRecursion.test.js +98 -0
- package/src/cli/wiki-manager.js +209 -7
- package/src/cli/wiki-manager.test.js +89 -0
- package/src/commands/slash.js +28 -10
- package/src/contracts/schemas.js +1 -1
- package/src/core/agentEvents.js +50 -0
- package/src/core/agentEvents.test.js +52 -0
- package/src/core/buildInfo.json +2 -2
- package/src/core/env.js +20 -1
- package/src/core/env.test.js +34 -0
- package/src/core/mcp.js +1 -1
- package/src/core/profile.js +19 -0
- package/src/core/runtimeLog.js +15 -0
- package/src/core/runtimeLog.test.js +15 -1
- package/src/core/skillChainView.js +84 -0
- package/src/core/skillChainView.test.js +50 -0
- package/src/core/skillCompiler.js +135 -0
- package/src/core/skillCompiler.test.js +91 -0
- package/src/core/skillInvocation.js +79 -0
- package/src/core/skillInvocation.test.js +73 -0
- package/src/core/skills.js +81 -19
- package/src/core/wikiWorkspace.test.js +34 -0
- package/src/core/workspaceProfile.test.js +55 -0
- package/src/runtime/client.js +45 -4
- package/src/runtime/controlCancellation.js +33 -0
- package/src/runtime/controlCancellation.test.js +49 -0
- package/src/runtime/controlDrain.js +50 -0
- package/src/runtime/controlDrain.test.js +38 -0
- package/src/runtime/server.js +341 -20
- package/src/runtime/server.test.js +344 -2
- package/src/runtime/skillChain.e2e.test.js +394 -0
- package/src/runtime/skillRun.js +104 -0
- package/src/runtime/skillRun.test.js +84 -0
- package/src/runtime/store.js +69 -0
- package/src/runtime/store.test.js +11 -0
- package/src/runtime/workspaceIsolation.test.js +178 -0
- package/src/shell/RightPane.tsx +3 -2
- package/src/shell/repl.js +51 -6
- package/src/shell/repl.test.js +41 -0
- package/src/shell/useSession.ts +43 -9
- package/wiki-workspace +137 -1
package/wiki-workspace
CHANGED
|
@@ -117,11 +117,33 @@ Commands:
|
|
|
117
117
|
wiki <workspace> down Stop all services for this workspace
|
|
118
118
|
wiki <workspace> logs [args...] Follow workspace service logs (tail 100 by default)
|
|
119
119
|
wiki <workspace> serve [--open] Start the web UI in foreground (--open launches browser)
|
|
120
|
+
wiki <workspace> reset [--dry-run] [--yes]
|
|
121
|
+
Empty the workspace, keeping .wikirc*, templates/ and
|
|
122
|
+
build-context/. Requires the services to be stopped.
|
|
120
123
|
wiki <workspace> doctor Run wiki doctor
|
|
121
124
|
wiki <workspace> ingest Run wiki ingest
|
|
122
125
|
wiki <workspace> build Run wiki build
|
|
123
126
|
wiki <workspace> export Run wiki export
|
|
124
|
-
wiki <workspace> run <args...> Run arbitrary wiki CLI args
|
|
127
|
+
wiki <workspace> run <args...> Run arbitrary wiki CLI args (see below)
|
|
128
|
+
|
|
129
|
+
wiki CLI commands reachable through `wiki <workspace> run`:
|
|
130
|
+
history [--file <path>] [--limit <n>] [--json]
|
|
131
|
+
List workspace history commits (Git, workspace-local)
|
|
132
|
+
restore --run <sha> [--dry-run] Revert every file changed by a run commit
|
|
133
|
+
restore --file <path> --to <sha> [--dry-run]
|
|
134
|
+
Restore one versioned file to a revision
|
|
135
|
+
query "<question>" Answer from the wiki and its cited source notes
|
|
136
|
+
index Create or update the local vector index
|
|
137
|
+
refresh Regenerate only the stale deliverables
|
|
138
|
+
lint Static checks: dead links, orphans, stale deliverables
|
|
139
|
+
add-skill <source> Install a workspace method (directory, .zip, HTTPS .zip)
|
|
140
|
+
config Show the effective .wikirc.yaml
|
|
141
|
+
group-concepts Regroup wiki concepts
|
|
142
|
+
doctor, ingest, build, export Also available directly: wiki <workspace> <command>
|
|
143
|
+
|
|
144
|
+
History is versioned for wiki/, templates/, build-context/, deliverables/,
|
|
145
|
+
raw/ingested/ and .wiki/build-state.json only. A restore adds a commit rather
|
|
146
|
+
than rewriting history, and --dry-run previews it without writing.
|
|
125
147
|
|
|
126
148
|
Configuration:
|
|
127
149
|
workspaces/<workspace>/.env
|
|
@@ -1177,6 +1199,117 @@ run_wiki() {
|
|
|
1177
1199
|
compose_for_workspace "$workspace" run --rm wiki "$@"
|
|
1178
1200
|
}
|
|
1179
1201
|
|
|
1202
|
+
# What `wiki <workspace> reset` keeps: the METHOD. `.wikirc*` (provider, model,
|
|
1203
|
+
# retrieval, per-profile variants), `templates/` and `build-context/` describe
|
|
1204
|
+
# how this workspace produces; everything else is what it has produced, cached
|
|
1205
|
+
# or logged. `.git/` is kept too — the history from before the reset stays
|
|
1206
|
+
# reachable through `wiki restore`, which is the only cheap undo there is.
|
|
1207
|
+
#
|
|
1208
|
+
# `.env` is kept for a harder reason than method: it IS the workspace's
|
|
1209
|
+
# registration — ports, MCP auth tokens, WIKI_WORKSPACE_PATH. Deleting it makes
|
|
1210
|
+
# the very next line of reset_workspace (`run_wiki … init`, which starts with
|
|
1211
|
+
# need_workspace_env) die under `set -euo pipefail`, leaving the workspace
|
|
1212
|
+
# emptied and never re-scaffolded. And recovering it with `config` mints new
|
|
1213
|
+
# ports and tokens, silently invalidating every reference to the old ones
|
|
1214
|
+
# (mcp.endpoints.json among them). Nothing here may drop it.
|
|
1215
|
+
workspace_reset_keep() {
|
|
1216
|
+
case "$1" in
|
|
1217
|
+
.|..|.git) return 0 ;;
|
|
1218
|
+
.env|.env.*) return 0 ;;
|
|
1219
|
+
.wikirc*) return 0 ;;
|
|
1220
|
+
templates|build-context) return 0 ;;
|
|
1221
|
+
*) return 1 ;;
|
|
1222
|
+
esac
|
|
1223
|
+
}
|
|
1224
|
+
|
|
1225
|
+
# Destructive, and deliberately reachable ONLY from this CLI: no `wiki reset`
|
|
1226
|
+
# subcommand, no production job type, no MCP tool, no skill. Nothing Donna can
|
|
1227
|
+
# call may erase a workspace.
|
|
1228
|
+
#
|
|
1229
|
+
# It also stops after re-scaffolding. Chaining a sync or a build here would be
|
|
1230
|
+
# convenient exactly once and wrong every other time: refilling the workspace
|
|
1231
|
+
# is the user's decision, not a side effect of emptying it.
|
|
1232
|
+
reset_workspace() {
|
|
1233
|
+
local workspace="$1"
|
|
1234
|
+
shift
|
|
1235
|
+
local assume_yes=0 dry_run=0
|
|
1236
|
+
while [[ $# -gt 0 ]]; do
|
|
1237
|
+
case "$1" in
|
|
1238
|
+
--yes|-y) assume_yes=1 ;;
|
|
1239
|
+
--dry-run) dry_run=1 ;;
|
|
1240
|
+
*) die "reset accepts only --yes and --dry-run (got: $1)" ;;
|
|
1241
|
+
esac
|
|
1242
|
+
shift
|
|
1243
|
+
done
|
|
1244
|
+
|
|
1245
|
+
need_workspace_env "$workspace"
|
|
1246
|
+
local ws_path
|
|
1247
|
+
ws_path="$(normalize_path "$(workspace_value "$workspace" WIKI_WORKSPACE_PATH)")"
|
|
1248
|
+
[[ -d "$ws_path" ]] || die "workspace directory not found: $ws_path"
|
|
1249
|
+
|
|
1250
|
+
# A container still writing into the bind mount would recreate part of what
|
|
1251
|
+
# we just erased, and leave files owned by another UID behind.
|
|
1252
|
+
local running_services=()
|
|
1253
|
+
read_lines_into_array running_services compose_for_workspace "$workspace" ps --status running --services
|
|
1254
|
+
if [[ ${#running_services[@]} -gt 0 ]]; then
|
|
1255
|
+
die "workspace services are still running (${running_services[*]}) — stop them first: wiki-workspace wiki $workspace down"
|
|
1256
|
+
fi
|
|
1257
|
+
|
|
1258
|
+
local entry name
|
|
1259
|
+
local removed=() kept=()
|
|
1260
|
+
for entry in "$ws_path"/* "$ws_path"/.*; do
|
|
1261
|
+
[[ -e "$entry" ]] || continue
|
|
1262
|
+
name="$(basename "$entry")"
|
|
1263
|
+
if workspace_reset_keep "$name"; then
|
|
1264
|
+
[[ "$name" == "." || "$name" == ".." ]] || kept+=("$name")
|
|
1265
|
+
continue
|
|
1266
|
+
fi
|
|
1267
|
+
removed+=("$name")
|
|
1268
|
+
done
|
|
1269
|
+
|
|
1270
|
+
printf 'Workspace: %s (%s)\n' "$workspace" "$ws_path"
|
|
1271
|
+
printf 'Keep: %s\n' "${kept[*]:-(nothing)}"
|
|
1272
|
+
printf 'Reset: %s\n' "${removed[*]:-(nothing)}"
|
|
1273
|
+
|
|
1274
|
+
if [[ ${#removed[@]} -eq 0 ]]; then
|
|
1275
|
+
printf 'Nothing to reset.\n'
|
|
1276
|
+
return
|
|
1277
|
+
fi
|
|
1278
|
+
|
|
1279
|
+
if [[ $dry_run -eq 1 ]]; then
|
|
1280
|
+
printf 'Dry run: nothing was deleted. Re-run without --dry-run to apply.\n'
|
|
1281
|
+
return
|
|
1282
|
+
fi
|
|
1283
|
+
|
|
1284
|
+
if [[ $assume_yes -eq 0 ]]; then
|
|
1285
|
+
[[ -t 0 ]] || die "reset needs a terminal to confirm — pass --yes for a non-interactive run"
|
|
1286
|
+
printf 'This deletes the wiki, the deliverables and the sources. Type the workspace name to confirm (%s): ' "$workspace"
|
|
1287
|
+
local answer=''
|
|
1288
|
+
IFS= read -r answer || true
|
|
1289
|
+
[[ "$answer" == "$workspace" ]] || die "reset aborted"
|
|
1290
|
+
fi
|
|
1291
|
+
|
|
1292
|
+
for name in "${removed[@]}"; do
|
|
1293
|
+
rm -rf -- "${ws_path:?}/$name" \
|
|
1294
|
+
|| die "could not remove $ws_path/$name — check file ownership (containers run as the node user), then retry"
|
|
1295
|
+
done
|
|
1296
|
+
|
|
1297
|
+
# Puts the structure back: empty raw/wiki/deliverables trees, .wiki/skills,
|
|
1298
|
+
# system-prompt, an empty profile, CLAUDE.md, .gitignore, and a fresh history
|
|
1299
|
+
# baseline. `wiki init` never overwrites an existing file, so the kept
|
|
1300
|
+
# `.wikirc*`, templates/ and build-context/ come through untouched.
|
|
1301
|
+
run_wiki "$workspace" init
|
|
1302
|
+
|
|
1303
|
+
# The scaffold ships a demo brief in raw/untracked/. Reappearing here it would
|
|
1304
|
+
# not read as a sample but as a pending source, and the next ingest would file
|
|
1305
|
+
# it into the wiki as if the user had provided it.
|
|
1306
|
+
rm -f -- "$ws_path/raw/untracked/demo-project-brief.md"
|
|
1307
|
+
|
|
1308
|
+
printf 'Reset done: %s\n' "$workspace"
|
|
1309
|
+
printf 'Kept: %s\n' "${kept[*]:-(nothing)}"
|
|
1310
|
+
printf 'Nothing was rebuilt. Bring the sources back when you decide to (e.g. /wiki-sync), then build.\n'
|
|
1311
|
+
}
|
|
1312
|
+
|
|
1180
1313
|
open_app_mode() {
|
|
1181
1314
|
local url="$1"
|
|
1182
1315
|
case "$(uname -s)" in
|
|
@@ -1487,6 +1620,9 @@ main() {
|
|
|
1487
1620
|
|
|
1488
1621
|
compose_for_workspace "$workspace" up serve
|
|
1489
1622
|
;;
|
|
1623
|
+
reset)
|
|
1624
|
+
reset_workspace "$workspace" "$@"
|
|
1625
|
+
;;
|
|
1490
1626
|
doctor|ingest|build|export)
|
|
1491
1627
|
run_wiki "$workspace" "$command" "$@"
|
|
1492
1628
|
;;
|