@time-machine-lab/tmlbrain 0.1.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/README.md +152 -0
- package/bin/tmlbrain.js +1653 -0
- package/docs/.gitkeep +0 -0
- package/docs/api/.gitkeep +0 -0
- package/docs/architecture.md +84 -0
- package/docs/backup.md +76 -0
- package/docs/decisions/.gitkeep +1 -0
- package/docs/decisions/0001-core-runtime.md +18 -0
- package/docs/design/.gitkeep +0 -0
- package/docs/fixtures/knowledge-sample/alpha-reference.md +14 -0
- package/docs/fixtures/knowledge-sample/project-alpha.md +18 -0
- package/docs/fixtures/patches/update-alpha-reference.patch +9 -0
- package/docs/indexing.md +32 -0
- package/docs/install.md +166 -0
- package/docs/preview/.gitkeep +0 -0
- package/docs/roadmap.md +27 -0
- package/docs/runtime.md +95 -0
- package/docs/server-api.md +120 -0
- package/docs/spec/.gitkeep +0 -0
- package/docs/spikes/cocoindex-local-indexing.md +31 -0
- package/docs/spikes/lightrag-retrieval.md +27 -0
- package/docs/sql/.gitkeep +0 -0
- package/docs/sync.md +110 -0
- package/knowledge/README.md +71 -0
- package/knowledge/_templates/area.md +18 -0
- package/knowledge/_templates/decision.md +18 -0
- package/knowledge/_templates/meeting.md +18 -0
- package/knowledge/_templates/project.md +18 -0
- package/knowledge/_templates/reference.md +18 -0
- package/knowledge/_templates/resource.md +18 -0
- package/package.json +41 -0
- package/scripts/README.md +12 -0
- package/scripts/backup/server-to-github.ps1 +20 -0
- package/scripts/backup/server-to-github.sh +13 -0
- package/scripts/docker/server-entrypoint.sh +84 -0
- package/scripts/install/install.ps1 +44 -0
- package/scripts/install/install.sh +41 -0
- package/scripts/release/parse-auto-release.js +166 -0
- package/scripts/sync/.gitkeep +1 -0
- package/scripts/sync/post-receive.sample +8 -0
- package/skills/tmlbrain/SKILL.md +192 -0
- package/skills/tmlbrain/agents/openai.yaml +7 -0
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# CocoIndex Local Indexing Spike
|
|
2
|
+
|
|
3
|
+
## Purpose
|
|
4
|
+
|
|
5
|
+
Evaluate CocoIndex as the preferred local incremental indexing pipeline for Markdown knowledge documents.
|
|
6
|
+
|
|
7
|
+
## Fit
|
|
8
|
+
|
|
9
|
+
CocoIndex matches the TMLBrain indexing role because it is designed around data transformation and indexing pipelines. For TMLBrain, it should scan `knowledge/**/*.md`, parse front matter and Markdown structure, detect changed files, and maintain derived local indexes without requiring a full manual rebuild for every edit.
|
|
10
|
+
|
|
11
|
+
## Proposed Pipeline
|
|
12
|
+
|
|
13
|
+
```text
|
|
14
|
+
knowledge/**/*.md
|
|
15
|
+
-> file path, mtime, sha256
|
|
16
|
+
-> front matter
|
|
17
|
+
-> headings
|
|
18
|
+
-> chunks
|
|
19
|
+
-> explicit links
|
|
20
|
+
-> local index artifacts
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## MVP Decision
|
|
24
|
+
|
|
25
|
+
The core CLI implements a deterministic dependency-light index first. CocoIndex remains the preferred graph runtime pipeline and is activated through optional graph setup so core sync does not depend on Python.
|
|
26
|
+
|
|
27
|
+
## Open Follow-ups
|
|
28
|
+
|
|
29
|
+
- Choose exact local storage for CocoIndex outputs.
|
|
30
|
+
- Validate install behavior on Windows.
|
|
31
|
+
- Confirm incremental update behavior with moved files.
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# LightRAG Retrieval Spike
|
|
2
|
+
|
|
3
|
+
## Purpose
|
|
4
|
+
|
|
5
|
+
Evaluate LightRAG as the preferred local graph and semantic retrieval layer for TMLBrain.
|
|
6
|
+
|
|
7
|
+
## Fit
|
|
8
|
+
|
|
9
|
+
LightRAG matches the retrieval role because it combines chunk retrieval with graph-enhanced context. For TMLBrain, it should sit above deterministic Markdown indexing and use local chunks plus explicit graph context before adding LLM-extracted entity and relation edges.
|
|
10
|
+
|
|
11
|
+
## MVP Decision
|
|
12
|
+
|
|
13
|
+
LightRAG is optional in the default install. Exact search and deterministic graph search must continue to work when LightRAG, model credentials, or local model resources are unavailable.
|
|
14
|
+
|
|
15
|
+
## Retrieval Order
|
|
16
|
+
|
|
17
|
+
```text
|
|
18
|
+
exact search
|
|
19
|
+
-> deterministic metadata/link graph
|
|
20
|
+
-> LightRAG graph/semantic retrieval
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## Open Follow-ups
|
|
24
|
+
|
|
25
|
+
- Decide local model vs cloud API for embeddings.
|
|
26
|
+
- Choose where LightRAG state is stored under `.tmlbrain/index/`.
|
|
27
|
+
- Define how Skill cites source documents and chunks returned by LightRAG.
|
|
File without changes
|
package/docs/sync.md
ADDED
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
# Server-Owned Sync
|
|
2
|
+
|
|
3
|
+
## User-Facing Model
|
|
4
|
+
|
|
5
|
+
Users ask TMLBrain to refresh their local read-only snapshot:
|
|
6
|
+
|
|
7
|
+
```text
|
|
8
|
+
tmlbrain sync --pull
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
Users ask TMLBrain to write knowledge through the server:
|
|
12
|
+
|
|
13
|
+
```text
|
|
14
|
+
tmlbrain save --title "Title" --content "Content"
|
|
15
|
+
tmlbrain save ./note.md
|
|
16
|
+
tmlbrain remote update --file knowledge/00-inbox/note.md --replace "old" --with "new"
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
They should not need to run `git pull`, `git push`, `git merge`, or `git rebase`.
|
|
20
|
+
Clients also should not perform hidden Git writes to the server. In the
|
|
21
|
+
HTTP-only workflow, clients do not need Git installed.
|
|
22
|
+
|
|
23
|
+
## Internal Model
|
|
24
|
+
|
|
25
|
+
TMLBrain uses Git only on the server write path:
|
|
26
|
+
|
|
27
|
+
```text
|
|
28
|
+
client local snapshot
|
|
29
|
+
<- HTTP snapshot
|
|
30
|
+
<- TMLBrain server API
|
|
31
|
+
|
|
32
|
+
client write request
|
|
33
|
+
-> TMLBrain server API
|
|
34
|
+
-> server worktree Markdown mutation
|
|
35
|
+
-> server validation
|
|
36
|
+
-> server Git commit
|
|
37
|
+
-> server bare repository
|
|
38
|
+
-> dedicated knowledge repository backup
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
## Conflict Handling
|
|
42
|
+
|
|
43
|
+
When the server cannot apply a requested update safely, it rejects the request
|
|
44
|
+
instead of silently overwriting remote knowledge. For precise text replacement,
|
|
45
|
+
the server requires the replacement text to match exactly once unless a broader
|
|
46
|
+
operation is explicitly requested.
|
|
47
|
+
|
|
48
|
+
When future merge flows need human review, TMLBrain should create conflict
|
|
49
|
+
packages under `.tmlbrain/conflicts/` instead of dropping the user into raw Git
|
|
50
|
+
conflict markers.
|
|
51
|
+
|
|
52
|
+
Conflict packages contain:
|
|
53
|
+
|
|
54
|
+
- conflict id;
|
|
55
|
+
- file path;
|
|
56
|
+
- reason;
|
|
57
|
+
- base content when available;
|
|
58
|
+
- local content or local patch;
|
|
59
|
+
- remote content or remote status;
|
|
60
|
+
- next actions.
|
|
61
|
+
|
|
62
|
+
The Skill reads the package, explains the conflict in normal language, and proposes a merged Markdown result for user confirmation.
|
|
63
|
+
|
|
64
|
+
## Server Topology
|
|
65
|
+
|
|
66
|
+
Recommended MVP server layout:
|
|
67
|
+
|
|
68
|
+
```text
|
|
69
|
+
/srv/tmlbrain.git bare repository, operational main copy
|
|
70
|
+
/srv/tmlbrain-worktree checked-out worktree for publishing and backup jobs
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
The server API should run from `/srv/tmlbrain-worktree`. After an accepted
|
|
74
|
+
write request, the server commits in the worktree and pushes to
|
|
75
|
+
`/srv/tmlbrain.git`. Backup to the dedicated knowledge repository is a separate
|
|
76
|
+
server-side job.
|
|
77
|
+
|
|
78
|
+
Recommended Docker server layout:
|
|
79
|
+
|
|
80
|
+
```text
|
|
81
|
+
/data/worktree checked-out worktree used by the server API
|
|
82
|
+
/data/tmlbrain.git local bare repository used by the server
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
The TMLBrain Docker image contains tooling and templates only. Real knowledge
|
|
86
|
+
should live in a dedicated knowledge repository configured with
|
|
87
|
+
`TMLBRAIN_KNOWLEDGE_REPO`. On first boot:
|
|
88
|
+
|
|
89
|
+
1. existing `/data/worktree` is reused;
|
|
90
|
+
2. otherwise `TMLBRAIN_KNOWLEDGE_REPO` is cloned into `/data/worktree`;
|
|
91
|
+
3. otherwise the server initializes a template-only skeleton.
|
|
92
|
+
|
|
93
|
+
If `TMLBRAIN_KNOWLEDGE_REPO` is set but the cloned repository does not contain
|
|
94
|
+
`knowledge/`, server startup fails instead of silently creating an empty
|
|
95
|
+
knowledge base.
|
|
96
|
+
|
|
97
|
+
## Client Configuration
|
|
98
|
+
|
|
99
|
+
Client server configuration lives in `.tmlbrain/state.json`.
|
|
100
|
+
|
|
101
|
+
Use:
|
|
102
|
+
|
|
103
|
+
```text
|
|
104
|
+
tmlbrain config show
|
|
105
|
+
tmlbrain config set-server http://server-host:7389 --token <token>
|
|
106
|
+
tmlbrain sync --pull
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
The config command reports whether a token exists, but it does not print the
|
|
110
|
+
token value.
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Knowledge Folder Rules
|
|
3
|
+
type: reference
|
|
4
|
+
status: active
|
|
5
|
+
owner: TML
|
|
6
|
+
tags: []
|
|
7
|
+
updated: 2026-06-17
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# Knowledge Folder
|
|
11
|
+
|
|
12
|
+
This folder stores the team's maintained knowledge documents.
|
|
13
|
+
|
|
14
|
+
## Structure
|
|
15
|
+
|
|
16
|
+
- `00-inbox/`: temporary notes waiting to be classified.
|
|
17
|
+
- `10-projects/`: project-specific documents, plans, decisions, and retrospectives.
|
|
18
|
+
- `20-areas/`: long-lived responsibility areas such as product, operations, engineering, brand, and business domains.
|
|
19
|
+
- `30-resources/`: reusable research, methods, notes, external references, and learning material.
|
|
20
|
+
- `40-references/`: stable reference material such as API notes, configuration, accounts, checklists, standards, and glossaries.
|
|
21
|
+
- `90-archive/`: inactive or historical documents kept for future search and traceability.
|
|
22
|
+
- `_templates/`: reusable Markdown templates for new documents.
|
|
23
|
+
|
|
24
|
+
User-facing requests such as "archive this to the knowledge base", "save
|
|
25
|
+
this", or "store this" mean the content should be saved into TMLBrain, normally
|
|
26
|
+
under `00-inbox/` first. Use `90-archive/` only for inactive historical content.
|
|
27
|
+
|
|
28
|
+
## Document Rules
|
|
29
|
+
|
|
30
|
+
Use Markdown by default. `00-inbox/` is intentionally low-friction and can hold incomplete notes. Documents outside `00-inbox/` are managed knowledge and must start with metadata:
|
|
31
|
+
|
|
32
|
+
```markdown
|
|
33
|
+
---
|
|
34
|
+
title: Document title
|
|
35
|
+
type: project | area | resource | reference | meeting | decision
|
|
36
|
+
owner: Team or person
|
|
37
|
+
status: draft | active | stale | archived
|
|
38
|
+
updated: YYYY-MM-DD
|
|
39
|
+
tags: []
|
|
40
|
+
---
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
Allowed `type` values:
|
|
44
|
+
|
|
45
|
+
- `project`: project plans, decisions, roadmaps, retrospectives, and project knowledge.
|
|
46
|
+
- `area`: durable team responsibility areas and operating domains.
|
|
47
|
+
- `resource`: reusable methods, research, notes, and external learning material.
|
|
48
|
+
- `reference`: stable facts, configuration, APIs, accounts, standards, and checklists.
|
|
49
|
+
- `meeting`: meeting records and summaries.
|
|
50
|
+
- `decision`: decisions with context and consequences.
|
|
51
|
+
|
|
52
|
+
Allowed `status` values:
|
|
53
|
+
|
|
54
|
+
- `draft`: incomplete or being shaped.
|
|
55
|
+
- `active`: current and expected to be useful.
|
|
56
|
+
- `stale`: retained and searchable, but likely needs review.
|
|
57
|
+
- `archived`: inactive but intentionally kept.
|
|
58
|
+
|
|
59
|
+
Documents in `90-archive/` must use `status: archived`. An archive reason is optional; retaining knowledge does not require a justification.
|
|
60
|
+
|
|
61
|
+
Prefer short, focused documents. If a document grows too large, split it by
|
|
62
|
+
topic and link related documents together.
|
|
63
|
+
|
|
64
|
+
## Maintenance Flow
|
|
65
|
+
|
|
66
|
+
1. Capture rough or unclassified material in `00-inbox/`.
|
|
67
|
+
2. Promote durable material into the folder that best describes its future use.
|
|
68
|
+
3. Keep metadata current enough for local indexing and AI filtering.
|
|
69
|
+
4. Use Markdown links or wiki links to connect related documents.
|
|
70
|
+
5. Mark stale content as `status: stale` instead of deleting it.
|
|
71
|
+
6. Move inactive content to `90-archive/` when it should stay searchable but no longer appears in active areas.
|
package/package.json
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@time-machine-lab/tmlbrain",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "TMLBrain local-first team knowledge base tooling.",
|
|
5
|
+
"type": "commonjs",
|
|
6
|
+
"bin": {
|
|
7
|
+
"tmlbrain": "bin/tmlbrain.js"
|
|
8
|
+
},
|
|
9
|
+
"files": [
|
|
10
|
+
"bin/",
|
|
11
|
+
"docs/",
|
|
12
|
+
"knowledge/README.md",
|
|
13
|
+
"knowledge/_templates/",
|
|
14
|
+
"scripts/",
|
|
15
|
+
"skills/",
|
|
16
|
+
"README.md"
|
|
17
|
+
],
|
|
18
|
+
"scripts": {
|
|
19
|
+
"tmlbrain": "node bin/tmlbrain.js",
|
|
20
|
+
"validate": "node bin/tmlbrain.js validate",
|
|
21
|
+
"index": "node bin/tmlbrain.js index",
|
|
22
|
+
"test": "node bin/tmlbrain.js validate && node bin/tmlbrain.js index --json"
|
|
23
|
+
},
|
|
24
|
+
"engines": {
|
|
25
|
+
"node": ">=18"
|
|
26
|
+
},
|
|
27
|
+
"publishConfig": {
|
|
28
|
+
"access": "public"
|
|
29
|
+
},
|
|
30
|
+
"repository": {
|
|
31
|
+
"type": "git",
|
|
32
|
+
"url": "git+https://github.com/Time-Machine-Lab/TMLBrain.git"
|
|
33
|
+
},
|
|
34
|
+
"keywords": [
|
|
35
|
+
"tmlbrain",
|
|
36
|
+
"knowledge-base",
|
|
37
|
+
"ai-skill",
|
|
38
|
+
"markdown"
|
|
39
|
+
],
|
|
40
|
+
"license": "UNLICENSED"
|
|
41
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
# Scripts
|
|
2
|
+
|
|
3
|
+
This folder contains automation wrappers for TMLBrain.
|
|
4
|
+
|
|
5
|
+
- `install/`: client bootstrap wrappers for Windows and macOS/Linux. They call `tmlbrain client install`.
|
|
6
|
+
- `sync/`: server-side Git hook templates for legacy/non-Docker deployments.
|
|
7
|
+
- `index/`: search index, metadata extraction, and knowledge graph generation.
|
|
8
|
+
- `backup/`: scheduled server-to-dedicated-knowledge-repository backup wrappers.
|
|
9
|
+
- `docker/`: server container entrypoint.
|
|
10
|
+
- `release/`: commit-message release instruction parsing for the auto-release workflow.
|
|
11
|
+
|
|
12
|
+
Scripts should support dry-run mode before modifying remote data.
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
param(
|
|
2
|
+
[string]$Remote = "backup",
|
|
3
|
+
[switch]$DryRun
|
|
4
|
+
)
|
|
5
|
+
|
|
6
|
+
$ErrorActionPreference = "Stop"
|
|
7
|
+
$root = Resolve-Path (Join-Path $PSScriptRoot "..\..")
|
|
8
|
+
$argsList = @("backup", "--remote", $Remote)
|
|
9
|
+
|
|
10
|
+
if ($DryRun) {
|
|
11
|
+
$argsList += "--dry-run"
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
Push-Location $root
|
|
15
|
+
try {
|
|
16
|
+
node ".\bin\tmlbrain.js" @argsList
|
|
17
|
+
}
|
|
18
|
+
finally {
|
|
19
|
+
Pop-Location
|
|
20
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
#!/usr/bin/env sh
|
|
2
|
+
set -eu
|
|
3
|
+
|
|
4
|
+
ROOT="$(CDPATH= cd -- "$(dirname -- "$0")/../.." && pwd)"
|
|
5
|
+
REMOTE="${TMLBRAIN_BACKUP_REMOTE:-backup}"
|
|
6
|
+
DRY_RUN=""
|
|
7
|
+
|
|
8
|
+
if [ "${1:-}" = "--dry-run" ]; then
|
|
9
|
+
DRY_RUN="--dry-run"
|
|
10
|
+
fi
|
|
11
|
+
|
|
12
|
+
cd "$ROOT"
|
|
13
|
+
node "./bin/tmlbrain.js" backup --remote "$REMOTE" $DRY_RUN
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
#!/usr/bin/env sh
|
|
2
|
+
set -eu
|
|
3
|
+
|
|
4
|
+
if [ -z "${TMLBRAIN_SERVER_TOKEN:-}" ]; then
|
|
5
|
+
echo "TMLBRAIN_SERVER_TOKEN is required for the TMLBrain server container." >&2
|
|
6
|
+
exit 1
|
|
7
|
+
fi
|
|
8
|
+
|
|
9
|
+
DATA_DIR="${TMLBRAIN_DATA_DIR:-/data}"
|
|
10
|
+
WORKTREE="${TMLBRAIN_WORKTREE:-$DATA_DIR/worktree}"
|
|
11
|
+
BARE_REPO="${TMLBRAIN_BARE_REPO:-$DATA_DIR/tmlbrain.git}"
|
|
12
|
+
KNOWLEDGE_REPO="${TMLBRAIN_KNOWLEDGE_REPO:-}"
|
|
13
|
+
KNOWLEDGE_REF="${TMLBRAIN_KNOWLEDGE_REF:-main}"
|
|
14
|
+
HOST="${TMLBRAIN_HOST:-0.0.0.0}"
|
|
15
|
+
PORT="${TMLBRAIN_PORT:-7389}"
|
|
16
|
+
|
|
17
|
+
mkdir -p "$DATA_DIR"
|
|
18
|
+
|
|
19
|
+
if [ ! -d "$WORKTREE/.git" ]; then
|
|
20
|
+
if [ -d "$BARE_REPO" ]; then
|
|
21
|
+
echo "Restoring TMLBrain worktree from existing local bare repository."
|
|
22
|
+
git clone "$BARE_REPO" "$WORKTREE"
|
|
23
|
+
elif [ -n "$KNOWLEDGE_REPO" ]; then
|
|
24
|
+
echo "Initializing TMLBrain knowledge from $KNOWLEDGE_REPO ($KNOWLEDGE_REF)."
|
|
25
|
+
git clone --branch "$KNOWLEDGE_REF" "$KNOWLEDGE_REPO" "$WORKTREE"
|
|
26
|
+
cd "$WORKTREE"
|
|
27
|
+
git remote rename origin backup
|
|
28
|
+
else
|
|
29
|
+
echo "No TMLBRAIN_KNOWLEDGE_REPO configured. Initializing template-only knowledge skeleton."
|
|
30
|
+
mkdir -p "$WORKTREE"
|
|
31
|
+
cp -R /app/knowledge "$WORKTREE/knowledge"
|
|
32
|
+
cd "$WORKTREE"
|
|
33
|
+
git init -b main
|
|
34
|
+
fi
|
|
35
|
+
fi
|
|
36
|
+
|
|
37
|
+
cd "$WORKTREE"
|
|
38
|
+
|
|
39
|
+
if [ ! -d .git ]; then
|
|
40
|
+
git init -b main
|
|
41
|
+
fi
|
|
42
|
+
|
|
43
|
+
if [ ! -d knowledge ]; then
|
|
44
|
+
if [ -n "$KNOWLEDGE_REPO" ]; then
|
|
45
|
+
echo "Knowledge repository must contain a knowledge/ directory." >&2
|
|
46
|
+
exit 1
|
|
47
|
+
fi
|
|
48
|
+
cp -R /app/knowledge "$WORKTREE/knowledge"
|
|
49
|
+
fi
|
|
50
|
+
|
|
51
|
+
git config user.name "${TMLBRAIN_GIT_USER_NAME:-TMLBrain Server}"
|
|
52
|
+
git config user.email "${TMLBRAIN_GIT_USER_EMAIL:-tmlbrain@localhost}"
|
|
53
|
+
|
|
54
|
+
if [ -n "$KNOWLEDGE_REPO" ]; then
|
|
55
|
+
if git remote get-url backup >/dev/null 2>&1; then
|
|
56
|
+
git remote set-url backup "$KNOWLEDGE_REPO"
|
|
57
|
+
else
|
|
58
|
+
git remote add backup "$KNOWLEDGE_REPO"
|
|
59
|
+
fi
|
|
60
|
+
fi
|
|
61
|
+
|
|
62
|
+
if ! git rev-parse --verify HEAD >/dev/null 2>&1; then
|
|
63
|
+
git add knowledge
|
|
64
|
+
git commit -m "Initialize TMLBrain knowledge"
|
|
65
|
+
fi
|
|
66
|
+
|
|
67
|
+
if [ ! -d "$BARE_REPO" ]; then
|
|
68
|
+
git clone --bare "$WORKTREE" "$BARE_REPO"
|
|
69
|
+
fi
|
|
70
|
+
|
|
71
|
+
if git remote get-url origin >/dev/null 2>&1; then
|
|
72
|
+
git remote set-url origin "$BARE_REPO"
|
|
73
|
+
else
|
|
74
|
+
git remote add origin "$BARE_REPO"
|
|
75
|
+
fi
|
|
76
|
+
|
|
77
|
+
git add knowledge
|
|
78
|
+
if ! git diff --cached --quiet; then
|
|
79
|
+
git commit -m "Initialize TMLBrain knowledge"
|
|
80
|
+
fi
|
|
81
|
+
|
|
82
|
+
git push -u origin HEAD:main >/dev/null 2>&1 || true
|
|
83
|
+
|
|
84
|
+
exec node /app/bin/tmlbrain.js serve --host "$HOST" --port "$PORT"
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
param(
|
|
2
|
+
[string]$Server = "",
|
|
3
|
+
[string]$Token = "",
|
|
4
|
+
[switch]$Local,
|
|
5
|
+
[switch]$Graph,
|
|
6
|
+
[switch]$DryRun,
|
|
7
|
+
[switch]$Yes
|
|
8
|
+
)
|
|
9
|
+
|
|
10
|
+
$ErrorActionPreference = "Stop"
|
|
11
|
+
$root = Resolve-Path (Join-Path $PSScriptRoot "..\..")
|
|
12
|
+
$argsList = @("client", "install")
|
|
13
|
+
|
|
14
|
+
if ($Server -ne "") {
|
|
15
|
+
$argsList += @("--server", $Server)
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
if ($Token -ne "") {
|
|
19
|
+
$argsList += @("--token", $Token)
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
if ($Local) {
|
|
23
|
+
$argsList += "--local"
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
if ($Graph) {
|
|
27
|
+
$argsList += "--graph"
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
if ($DryRun) {
|
|
31
|
+
$argsList += "--dry-run"
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
if ($Yes) {
|
|
35
|
+
$argsList += "--yes"
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
Push-Location $root
|
|
39
|
+
try {
|
|
40
|
+
node ".\bin\tmlbrain.js" @argsList
|
|
41
|
+
}
|
|
42
|
+
finally {
|
|
43
|
+
Pop-Location
|
|
44
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
#!/usr/bin/env sh
|
|
2
|
+
set -eu
|
|
3
|
+
|
|
4
|
+
ROOT="$(CDPATH= cd -- "$(dirname -- "$0")/../.." && pwd)"
|
|
5
|
+
ARGS="client install"
|
|
6
|
+
|
|
7
|
+
while [ "$#" -gt 0 ]; do
|
|
8
|
+
case "$1" in
|
|
9
|
+
--server)
|
|
10
|
+
ARGS="$ARGS --server $2"
|
|
11
|
+
shift 2
|
|
12
|
+
;;
|
|
13
|
+
--token)
|
|
14
|
+
ARGS="$ARGS --token $2"
|
|
15
|
+
shift 2
|
|
16
|
+
;;
|
|
17
|
+
--local)
|
|
18
|
+
ARGS="$ARGS --local"
|
|
19
|
+
shift
|
|
20
|
+
;;
|
|
21
|
+
--graph)
|
|
22
|
+
ARGS="$ARGS --graph"
|
|
23
|
+
shift
|
|
24
|
+
;;
|
|
25
|
+
--dry-run)
|
|
26
|
+
ARGS="$ARGS --dry-run"
|
|
27
|
+
shift
|
|
28
|
+
;;
|
|
29
|
+
--yes)
|
|
30
|
+
ARGS="$ARGS --yes"
|
|
31
|
+
shift
|
|
32
|
+
;;
|
|
33
|
+
*)
|
|
34
|
+
echo "Unknown option: $1" >&2
|
|
35
|
+
exit 1
|
|
36
|
+
;;
|
|
37
|
+
esac
|
|
38
|
+
done
|
|
39
|
+
|
|
40
|
+
cd "$ROOT"
|
|
41
|
+
node "./bin/tmlbrain.js" $ARGS
|