backlog-tiny-mcp 0.35.0__py3-none-any.whl
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.
- backlog_mcp/__init__.py +29 -0
- backlog_mcp/__main__.py +10 -0
- backlog_mcp/auth.py +199 -0
- backlog_mcp/backlog.py +696 -0
- backlog_mcp/cli.py +2046 -0
- backlog_mcp/client.py +320 -0
- backlog_mcp/computer.py +33 -0
- backlog_mcp/database.py +80 -0
- backlog_mcp/embeddings.py +900 -0
- backlog_mcp/global_rules.md +126 -0
- backlog_mcp/guidance.py +11 -0
- backlog_mcp/guide/index.md +11 -0
- backlog_mcp/guide/memory.md +27 -0
- backlog_mcp/guide/projects.md +16 -0
- backlog_mcp/guide/search.md +72 -0
- backlog_mcp/guide/tasks.md +40 -0
- backlog_mcp/guide/workflow.md +22 -0
- backlog_mcp/httpd.py +270 -0
- backlog_mcp/migrate.py +113 -0
- backlog_mcp/migrations/0001-initial.sql +194 -0
- backlog_mcp/migrations/0002-task-assignment.sql +2 -0
- backlog_mcp/migrations/0003-task-edit-claims.sql +5 -0
- backlog_mcp/migrations/0004-memory-visibility.sql +42 -0
- backlog_mcp/model/CITATION.bib +9 -0
- backlog_mcp/model/LICENSE +202 -0
- backlog_mcp/model/README.md +12 -0
- backlog_mcp/model/UPSTREAM.md +2053 -0
- backlog_mcp/model/config.json +12 -0
- backlog_mcp/model/model.safetensors +4 -0
- backlog_mcp/model/modules.json +14 -0
- backlog_mcp/model/provenance.json +16 -0
- backlog_mcp/model/tokenizer.json +1 -0
- backlog_mcp/models.py +581 -0
- backlog_mcp/names.py +35 -0
- backlog_mcp/paths.py +53 -0
- backlog_mcp/protocol_storage.py +104 -0
- backlog_mcp/queries.py +7 -0
- backlog_mcp/queries.sql +531 -0
- backlog_mcp/records.py +215 -0
- backlog_mcp/render.py +479 -0
- backlog_mcp/server.py +2864 -0
- backlog_mcp/skills/autopilot/SKILL.md +96 -0
- backlog_mcp/skills/planning/SKILL.md +106 -0
- backlog_mcp/skills/planning/references/splitting.md +45 -0
- backlog_mcp/skills/triage/SKILL.md +104 -0
- backlog_mcp/skills/triage/references/conventions.md +43 -0
- backlog_mcp/skills.py +56 -0
- backlog_mcp/static/agent-config.js +20 -0
- backlog_mcp/static/app.css +1950 -0
- backlog_mcp/static/app.js +1301 -0
- backlog_mcp/static/assignments.js +96 -0
- backlog_mcp/static/breadcrumbs.js +54 -0
- backlog_mcp/static/comment-composer.js +95 -0
- backlog_mcp/static/connect.css +98 -0
- backlog_mcp/static/connect.html +74 -0
- backlog_mcp/static/connect.js +160 -0
- backlog_mcp/static/credentials.js +72 -0
- backlog_mcp/static/diagrams.js +128 -0
- backlog_mcp/static/dom.js +162 -0
- backlog_mcp/static/editor-claim.js +104 -0
- backlog_mcp/static/editor.js +355 -0
- backlog_mcp/static/index.html +137 -0
- backlog_mcp/static/markdown.css +33 -0
- backlog_mcp/static/markdown.js +72 -0
- backlog_mcp/static/mcp.js +177 -0
- backlog_mcp/static/memory-append.js +34 -0
- backlog_mcp/static/memory-editor.js +173 -0
- backlog_mcp/static/memory.js +279 -0
- backlog_mcp/static/package.json +1 -0
- backlog_mcp/static/project-form.js +71 -0
- backlog_mcp/static/project-settings.js +225 -0
- backlog_mcp/static/scope.js +90 -0
- backlog_mcp/static/statistics.js +87 -0
- backlog_mcp/static/task-browser.js +100 -0
- backlog_mcp/static/task-pagination.js +94 -0
- backlog_mcp/static/task-picker.js +164 -0
- backlog_mcp/static/task-table.js +74 -0
- backlog_mcp/static/vendor/README.md +12 -0
- backlog_mcp/static/vendor/dompurify-LICENSE +202 -0
- backlog_mcp/static/vendor/highlight-LICENSE +29 -0
- backlog_mcp/static/vendor/highlight-dark.css +118 -0
- backlog_mcp/static/vendor/highlight-light.css +118 -0
- backlog_mcp/static/vendor/highlight.min.js +1262 -0
- backlog_mcp/static/vendor/marked-LICENSE +44 -0
- backlog_mcp/static/vendor/marked.esm.js +80 -0
- backlog_mcp/static/vendor/marked.esm.js.map +7 -0
- backlog_mcp/static/vendor/mermaid-LICENSE +21 -0
- backlog_mcp/static/vendor/mermaid.min.js +4376 -0
- backlog_mcp/static/vendor/purify.es.mjs +2722 -0
- backlog_mcp/static/vendor/purify.es.mjs.map +1 -0
- backlog_mcp/transaction.py +47 -0
- backlog_mcp/version.py +79 -0
- backlog_mcp/webui.py +63 -0
- backlog_tiny_mcp-0.35.0.dist-info/METADATA +84 -0
- backlog_tiny_mcp-0.35.0.dist-info/RECORD +97 -0
- backlog_tiny_mcp-0.35.0.dist-info/WHEEL +4 -0
- backlog_tiny_mcp-0.35.0.dist-info/entry_points.txt +4 -0
backlog_mcp/migrate.py
ADDED
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
"""Apply numbered SQL files on the application database connection."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
import asyncio
|
|
6
|
+
import logging
|
|
7
|
+
import re
|
|
8
|
+
import sqlite3
|
|
9
|
+
import time
|
|
10
|
+
from hashlib import sha256
|
|
11
|
+
from pathlib import Path
|
|
12
|
+
|
|
13
|
+
import aiosqlite
|
|
14
|
+
|
|
15
|
+
from .transaction import Transaction
|
|
16
|
+
|
|
17
|
+
# Migration setup and bookkeeping are inline SQL exceptions: the migrator must not
|
|
18
|
+
# depend on application queries.sql. Application queries belong in queries.sql;
|
|
19
|
+
# application schema changes belong in migrations/*.sql.
|
|
20
|
+
MIGRATIONS = Path(__file__).with_name("migrations")
|
|
21
|
+
APPLICATION_ID = 1112296275
|
|
22
|
+
log = logging.getLogger(__name__)
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
def candidates(directory: Path) -> dict[Path, str]:
|
|
26
|
+
"""Collect migration paths and SHA-256 hashes."""
|
|
27
|
+
files: dict[Path, str] = {}
|
|
28
|
+
versions: set[int] = set()
|
|
29
|
+
for path in directory.glob("*.sql"):
|
|
30
|
+
match = re.fullmatch(r"(\d{4})-[a-z0-9-]+\.sql", path.name)
|
|
31
|
+
if match is None:
|
|
32
|
+
raise ValueError(f"invalid migration filename: {path.name}")
|
|
33
|
+
version = int(match[1])
|
|
34
|
+
if version in versions:
|
|
35
|
+
raise ValueError(f"duplicate migration number: {version:04d}")
|
|
36
|
+
versions.add(version)
|
|
37
|
+
files[path] = sha256(path.read_bytes()).hexdigest()
|
|
38
|
+
return files
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
async def applied(connection: aiosqlite.Connection, directory: Path) -> dict[Path, str]:
|
|
42
|
+
rows = await connection.execute_fetchall("SELECT filename, sha256 FROM migrations")
|
|
43
|
+
return {directory / row[0]: row[1] for row in rows}
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
async def migrate(
|
|
47
|
+
connection: aiosqlite.Connection,
|
|
48
|
+
directory: Path = MIGRATIONS,
|
|
49
|
+
*,
|
|
50
|
+
transaction: Transaction | None = None,
|
|
51
|
+
) -> None:
|
|
52
|
+
"""Apply each pending file and record it in the same transaction.
|
|
53
|
+
|
|
54
|
+
SQL files contain statements, without BEGIN/COMMIT. complete_statement preserves trigger
|
|
55
|
+
bodies and quoted semicolons; executescript would implicitly commit an existing transaction.
|
|
56
|
+
"""
|
|
57
|
+
current = "migration setup"
|
|
58
|
+
try:
|
|
59
|
+
async with transaction or Transaction(connection, asyncio.Lock()):
|
|
60
|
+
async with connection.execute("PRAGMA application_id") as cursor:
|
|
61
|
+
row = await cursor.fetchone()
|
|
62
|
+
assert row is not None
|
|
63
|
+
marker = row[0]
|
|
64
|
+
if marker != APPLICATION_ID:
|
|
65
|
+
tables = await connection.execute_fetchall(
|
|
66
|
+
"SELECT name FROM sqlite_master WHERE type = 'table' AND name NOT LIKE 'mcp_%'"
|
|
67
|
+
)
|
|
68
|
+
if marker or tables:
|
|
69
|
+
raise ValueError("Unsupported database schema. Import old data separately.")
|
|
70
|
+
await connection.execute("""
|
|
71
|
+
CREATE TABLE IF NOT EXISTS migrations (
|
|
72
|
+
filename TEXT PRIMARY KEY,
|
|
73
|
+
sha256 TEXT NOT NULL,
|
|
74
|
+
applied_at REAL NOT NULL
|
|
75
|
+
)
|
|
76
|
+
""")
|
|
77
|
+
files, previous = await asyncio.gather(
|
|
78
|
+
asyncio.to_thread(candidates, directory),
|
|
79
|
+
applied(connection, directory),
|
|
80
|
+
)
|
|
81
|
+
missing = previous.keys() - files.keys()
|
|
82
|
+
if missing:
|
|
83
|
+
raise ValueError(f"applied migration is missing: {min(missing).name}")
|
|
84
|
+
pending: set[tuple[Path, str]] = files.items() - previous.items()
|
|
85
|
+
changed = {path for path, _ in pending} & previous.keys()
|
|
86
|
+
if changed:
|
|
87
|
+
raise ValueError(f"applied migration SHA-256 changed: {min(changed).name}")
|
|
88
|
+
log.info("%d migrations needed", len(pending))
|
|
89
|
+
for path, checksum in sorted(pending):
|
|
90
|
+
current = path.name
|
|
91
|
+
log.info("Applying migration %s", path.name)
|
|
92
|
+
content = await asyncio.to_thread(path.read_bytes)
|
|
93
|
+
if sha256(content).hexdigest() != checksum:
|
|
94
|
+
raise ValueError(f"migration changed after discovery: {path.name}")
|
|
95
|
+
statement = ""
|
|
96
|
+
for part in content.decode("utf-8").split(";"):
|
|
97
|
+
statement += part + ";"
|
|
98
|
+
if sqlite3.complete_statement(statement):
|
|
99
|
+
await connection.execute(statement)
|
|
100
|
+
statement = ""
|
|
101
|
+
if statement.strip():
|
|
102
|
+
await connection.execute(statement)
|
|
103
|
+
await connection.execute(
|
|
104
|
+
"INSERT INTO migrations(filename, sha256, applied_at) VALUES (?, ?, ?)",
|
|
105
|
+
(path.name, checksum, time.time()),
|
|
106
|
+
)
|
|
107
|
+
current = "migration commit"
|
|
108
|
+
except BaseException:
|
|
109
|
+
log.exception("Migration failed during %s; transaction rolled back", current)
|
|
110
|
+
log.warning("Migration transaction rolled back")
|
|
111
|
+
raise
|
|
112
|
+
for path, checksum in sorted(pending):
|
|
113
|
+
log.info("Applied migration %s (sha256=%s)", path.name, checksum)
|
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
-- Initial schema. Existing 0.2 databases retain their data.
|
|
2
|
+
|
|
3
|
+
CREATE TABLE IF NOT EXISTS principals (
|
|
4
|
+
identity TEXT PRIMARY KEY,
|
|
5
|
+
handle TEXT NOT NULL UNIQUE,
|
|
6
|
+
name TEXT NOT NULL
|
|
7
|
+
);
|
|
8
|
+
|
|
9
|
+
CREATE TABLE IF NOT EXISTS projects (
|
|
10
|
+
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
11
|
+
owner TEXT NOT NULL REFERENCES principals(identity),
|
|
12
|
+
slug TEXT NOT NULL,
|
|
13
|
+
name TEXT NOT NULL,
|
|
14
|
+
description TEXT NOT NULL DEFAULT '',
|
|
15
|
+
preferred_language TEXT,
|
|
16
|
+
archived INTEGER NOT NULL DEFAULT 0,
|
|
17
|
+
created_at REAL NOT NULL,
|
|
18
|
+
updated_at REAL NOT NULL,
|
|
19
|
+
created_principal TEXT NOT NULL REFERENCES principals(identity),
|
|
20
|
+
created_computer TEXT NOT NULL,
|
|
21
|
+
updated_principal TEXT NOT NULL REFERENCES principals(identity),
|
|
22
|
+
updated_computer TEXT NOT NULL,
|
|
23
|
+
UNIQUE(owner, slug)
|
|
24
|
+
);
|
|
25
|
+
|
|
26
|
+
CREATE TABLE IF NOT EXISTS project_members (
|
|
27
|
+
project_id INTEGER NOT NULL REFERENCES projects(id) ON DELETE CASCADE,
|
|
28
|
+
principal TEXT NOT NULL REFERENCES principals(identity),
|
|
29
|
+
role TEXT NOT NULL CHECK(role IN ('owner', 'editor', 'reader')),
|
|
30
|
+
PRIMARY KEY(project_id, principal)
|
|
31
|
+
);
|
|
32
|
+
|
|
33
|
+
CREATE TABLE IF NOT EXISTS project_roots (
|
|
34
|
+
project_id INTEGER NOT NULL REFERENCES projects(id) ON DELETE CASCADE,
|
|
35
|
+
principal TEXT NOT NULL REFERENCES principals(identity),
|
|
36
|
+
computer TEXT NOT NULL,
|
|
37
|
+
root TEXT NOT NULL,
|
|
38
|
+
PRIMARY KEY(project_id, principal, computer, root)
|
|
39
|
+
);
|
|
40
|
+
|
|
41
|
+
CREATE TABLE IF NOT EXISTS tasks (
|
|
42
|
+
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
43
|
+
project_id INTEGER NOT NULL REFERENCES projects(id) ON DELETE CASCADE,
|
|
44
|
+
title TEXT NOT NULL,
|
|
45
|
+
body TEXT NOT NULL DEFAULT '',
|
|
46
|
+
status TEXT NOT NULL DEFAULT 'todo',
|
|
47
|
+
priority INTEGER NOT NULL DEFAULT 2,
|
|
48
|
+
tags TEXT NOT NULL DEFAULT '',
|
|
49
|
+
created_at REAL NOT NULL,
|
|
50
|
+
updated_at REAL NOT NULL,
|
|
51
|
+
closed_at REAL,
|
|
52
|
+
created_principal TEXT NOT NULL REFERENCES principals(identity),
|
|
53
|
+
created_computer TEXT NOT NULL,
|
|
54
|
+
updated_principal TEXT NOT NULL REFERENCES principals(identity),
|
|
55
|
+
updated_computer TEXT NOT NULL
|
|
56
|
+
);
|
|
57
|
+
|
|
58
|
+
CREATE TABLE IF NOT EXISTS notes (
|
|
59
|
+
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
60
|
+
project_id INTEGER NOT NULL REFERENCES projects(id) ON DELETE CASCADE,
|
|
61
|
+
title TEXT NOT NULL,
|
|
62
|
+
body TEXT NOT NULL DEFAULT '',
|
|
63
|
+
tags TEXT NOT NULL DEFAULT '',
|
|
64
|
+
shared INTEGER NOT NULL DEFAULT 0,
|
|
65
|
+
created_at REAL NOT NULL,
|
|
66
|
+
updated_at REAL NOT NULL,
|
|
67
|
+
created_principal TEXT NOT NULL REFERENCES principals(identity),
|
|
68
|
+
created_computer TEXT NOT NULL,
|
|
69
|
+
updated_principal TEXT NOT NULL REFERENCES principals(identity),
|
|
70
|
+
updated_computer TEXT NOT NULL,
|
|
71
|
+
UNIQUE(project_id, title)
|
|
72
|
+
);
|
|
73
|
+
|
|
74
|
+
CREATE TABLE IF NOT EXISTS task_comments (
|
|
75
|
+
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
76
|
+
task_id INTEGER NOT NULL REFERENCES tasks(id) ON DELETE CASCADE,
|
|
77
|
+
body TEXT NOT NULL,
|
|
78
|
+
kind TEXT NOT NULL DEFAULT 'comment' CHECK(kind IN ('comment', 'status', 'move')),
|
|
79
|
+
created_at REAL NOT NULL,
|
|
80
|
+
principal TEXT NOT NULL REFERENCES principals(identity),
|
|
81
|
+
computer TEXT NOT NULL
|
|
82
|
+
);
|
|
83
|
+
|
|
84
|
+
CREATE TABLE IF NOT EXISTS task_links (
|
|
85
|
+
task_id INTEGER NOT NULL REFERENCES tasks(id) ON DELETE CASCADE,
|
|
86
|
+
target_id INTEGER NOT NULL REFERENCES tasks(id) ON DELETE CASCADE,
|
|
87
|
+
relation TEXT NOT NULL CHECK(relation IN (
|
|
88
|
+
'part_of', 'contains', 'depends_on', 'blocks', 'caused_by', 'causes', 'related_to'
|
|
89
|
+
)),
|
|
90
|
+
reason TEXT NOT NULL DEFAULT '',
|
|
91
|
+
created_at REAL NOT NULL,
|
|
92
|
+
updated_at REAL NOT NULL,
|
|
93
|
+
created_principal TEXT NOT NULL REFERENCES principals(identity),
|
|
94
|
+
created_computer TEXT NOT NULL,
|
|
95
|
+
updated_principal TEXT NOT NULL REFERENCES principals(identity),
|
|
96
|
+
updated_computer TEXT NOT NULL,
|
|
97
|
+
PRIMARY KEY(task_id, relation, target_id),
|
|
98
|
+
CHECK(task_id != target_id)
|
|
99
|
+
);
|
|
100
|
+
CREATE INDEX IF NOT EXISTS links_by_target ON task_links(target_id);
|
|
101
|
+
|
|
102
|
+
CREATE INDEX IF NOT EXISTS memberships_by_principal ON project_members(principal, project_id);
|
|
103
|
+
CREATE UNIQUE INDEX IF NOT EXISTS project_roots_unique_path
|
|
104
|
+
ON project_roots(principal, computer, root) WHERE root != '';
|
|
105
|
+
CREATE INDEX IF NOT EXISTS tasks_by_project ON tasks(project_id, status, priority);
|
|
106
|
+
CREATE INDEX IF NOT EXISTS tasks_by_update ON tasks(updated_at DESC);
|
|
107
|
+
CREATE INDEX IF NOT EXISTS notes_by_update ON notes(updated_at DESC);
|
|
108
|
+
CREATE INDEX IF NOT EXISTS comments_by_task ON task_comments(task_id, created_at, id);
|
|
109
|
+
|
|
110
|
+
CREATE VIRTUAL TABLE IF NOT EXISTS projects_fts USING fts5 (
|
|
111
|
+
slug, name, description, content='projects', content_rowid='id',
|
|
112
|
+
tokenize="unicode61 remove_diacritics 2"
|
|
113
|
+
);
|
|
114
|
+
CREATE TRIGGER IF NOT EXISTS projects_fts_insert AFTER INSERT ON projects BEGIN
|
|
115
|
+
INSERT INTO projects_fts(rowid, slug, name, description) VALUES (new.id, new.slug, new.name, new.description);
|
|
116
|
+
END;
|
|
117
|
+
CREATE TRIGGER IF NOT EXISTS projects_fts_delete AFTER DELETE ON projects BEGIN
|
|
118
|
+
INSERT INTO projects_fts(projects_fts, rowid, slug, name, description)
|
|
119
|
+
VALUES ('delete', old.id, old.slug, old.name, old.description);
|
|
120
|
+
END;
|
|
121
|
+
CREATE TRIGGER IF NOT EXISTS projects_fts_update AFTER UPDATE ON projects BEGIN
|
|
122
|
+
INSERT INTO projects_fts(projects_fts, rowid, slug, name, description)
|
|
123
|
+
VALUES ('delete', old.id, old.slug, old.name, old.description);
|
|
124
|
+
INSERT INTO projects_fts(rowid, slug, name, description) VALUES (new.id, new.slug, new.name, new.description);
|
|
125
|
+
END;
|
|
126
|
+
|
|
127
|
+
CREATE VIRTUAL TABLE IF NOT EXISTS tasks_fts USING fts5 (
|
|
128
|
+
title, body, tags, content='tasks', content_rowid='id',
|
|
129
|
+
tokenize="unicode61 remove_diacritics 2"
|
|
130
|
+
);
|
|
131
|
+
CREATE TRIGGER IF NOT EXISTS tasks_fts_insert AFTER INSERT ON tasks BEGIN
|
|
132
|
+
INSERT INTO tasks_fts(rowid, title, body, tags) VALUES (new.id, new.title, new.body, new.tags);
|
|
133
|
+
END;
|
|
134
|
+
CREATE TRIGGER IF NOT EXISTS tasks_fts_delete AFTER DELETE ON tasks BEGIN
|
|
135
|
+
INSERT INTO tasks_fts(tasks_fts, rowid, title, body, tags) VALUES ('delete', old.id, old.title, old.body, old.tags);
|
|
136
|
+
END;
|
|
137
|
+
CREATE TRIGGER IF NOT EXISTS tasks_fts_update AFTER UPDATE ON tasks BEGIN
|
|
138
|
+
INSERT INTO tasks_fts(tasks_fts, rowid, title, body, tags) VALUES ('delete', old.id, old.title, old.body, old.tags);
|
|
139
|
+
INSERT INTO tasks_fts(rowid, title, body, tags) VALUES (new.id, new.title, new.body, new.tags);
|
|
140
|
+
END;
|
|
141
|
+
|
|
142
|
+
CREATE VIRTUAL TABLE IF NOT EXISTS notes_fts USING fts5 (
|
|
143
|
+
title, body, tags, content='notes', content_rowid='id',
|
|
144
|
+
tokenize="unicode61 remove_diacritics 2"
|
|
145
|
+
);
|
|
146
|
+
CREATE TRIGGER IF NOT EXISTS notes_fts_insert AFTER INSERT ON notes BEGIN
|
|
147
|
+
INSERT INTO notes_fts(rowid, title, body, tags) VALUES (new.id, new.title, new.body, new.tags);
|
|
148
|
+
END;
|
|
149
|
+
CREATE TRIGGER IF NOT EXISTS notes_fts_delete AFTER DELETE ON notes BEGIN
|
|
150
|
+
INSERT INTO notes_fts(notes_fts, rowid, title, body, tags) VALUES ('delete', old.id, old.title, old.body, old.tags);
|
|
151
|
+
END;
|
|
152
|
+
CREATE TRIGGER IF NOT EXISTS notes_fts_update AFTER UPDATE ON notes BEGIN
|
|
153
|
+
INSERT INTO notes_fts(notes_fts, rowid, title, body, tags) VALUES ('delete', old.id, old.title, old.body, old.tags);
|
|
154
|
+
INSERT INTO notes_fts(rowid, title, body, tags) VALUES (new.id, new.title, new.body, new.tags);
|
|
155
|
+
END;
|
|
156
|
+
|
|
157
|
+
CREATE VIRTUAL TABLE IF NOT EXISTS comments_fts USING fts5 (
|
|
158
|
+
body, content='task_comments', content_rowid='id',
|
|
159
|
+
tokenize="unicode61 remove_diacritics 2"
|
|
160
|
+
);
|
|
161
|
+
CREATE TRIGGER IF NOT EXISTS comments_fts_insert AFTER INSERT ON task_comments BEGIN
|
|
162
|
+
INSERT INTO comments_fts(rowid, body) VALUES (new.id, new.body);
|
|
163
|
+
END;
|
|
164
|
+
CREATE TRIGGER IF NOT EXISTS comments_fts_delete AFTER DELETE ON task_comments BEGIN
|
|
165
|
+
INSERT INTO comments_fts(comments_fts, rowid, body) VALUES ('delete', old.id, old.body);
|
|
166
|
+
END;
|
|
167
|
+
CREATE TRIGGER IF NOT EXISTS comments_fts_update AFTER UPDATE ON task_comments BEGIN
|
|
168
|
+
INSERT INTO comments_fts(comments_fts, rowid, body) VALUES ('delete', old.id, old.body);
|
|
169
|
+
INSERT INTO comments_fts(rowid, body) VALUES (new.id, new.body);
|
|
170
|
+
END;
|
|
171
|
+
|
|
172
|
+
CREATE TRIGGER IF NOT EXISTS task_status_history AFTER UPDATE OF status ON tasks
|
|
173
|
+
WHEN old.status != new.status BEGIN
|
|
174
|
+
INSERT INTO task_comments(task_id, body, kind, created_at, principal, computer)
|
|
175
|
+
VALUES (new.id, 'Status changed: ' || old.status || ' → ' || new.status,
|
|
176
|
+
'status', new.updated_at, new.updated_principal, new.updated_computer);
|
|
177
|
+
END;
|
|
178
|
+
CREATE TRIGGER IF NOT EXISTS task_move_history AFTER UPDATE OF project_id ON tasks
|
|
179
|
+
WHEN old.project_id != new.project_id BEGIN
|
|
180
|
+
INSERT INTO task_comments(task_id, body, kind, created_at, principal, computer)
|
|
181
|
+
VALUES (new.id, 'Moved: ' || (SELECT u.handle || '/' || p.slug FROM projects p
|
|
182
|
+
JOIN principals u ON u.identity = p.owner WHERE p.id = old.project_id)
|
|
183
|
+
|| ' → ' || (SELECT u.handle || '/' || p.slug FROM projects p
|
|
184
|
+
JOIN principals u ON u.identity = p.owner WHERE p.id = new.project_id),
|
|
185
|
+
'move', new.updated_at, new.updated_principal, new.updated_computer);
|
|
186
|
+
END;
|
|
187
|
+
CREATE TRIGGER IF NOT EXISTS comment_updates_task AFTER INSERT ON task_comments
|
|
188
|
+
WHEN new.kind = 'comment' BEGIN
|
|
189
|
+
UPDATE tasks SET updated_at = new.created_at,
|
|
190
|
+
updated_principal = new.principal, updated_computer = new.computer
|
|
191
|
+
WHERE id = new.task_id;
|
|
192
|
+
END;
|
|
193
|
+
|
|
194
|
+
PRAGMA application_id = 1112296275;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
-- Existing entries keep their project access.
|
|
2
|
+
CREATE TABLE notes_new (
|
|
3
|
+
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
4
|
+
project_id INTEGER NOT NULL REFERENCES projects(id) ON DELETE CASCADE,
|
|
5
|
+
title TEXT NOT NULL,
|
|
6
|
+
body TEXT NOT NULL DEFAULT '',
|
|
7
|
+
tags TEXT NOT NULL DEFAULT '',
|
|
8
|
+
shared INTEGER NOT NULL DEFAULT 0 CHECK(shared IN (0, 1)),
|
|
9
|
+
global_scope INTEGER NOT NULL DEFAULT 0 CHECK(global_scope IN (0, 1)),
|
|
10
|
+
created_at REAL NOT NULL,
|
|
11
|
+
updated_at REAL NOT NULL,
|
|
12
|
+
created_principal TEXT NOT NULL REFERENCES principals(identity),
|
|
13
|
+
created_computer TEXT NOT NULL,
|
|
14
|
+
updated_principal TEXT NOT NULL REFERENCES principals(identity),
|
|
15
|
+
updated_computer TEXT NOT NULL
|
|
16
|
+
);
|
|
17
|
+
INSERT INTO notes_new SELECT id, project_id, title, body, tags, 1, 0, created_at, updated_at,
|
|
18
|
+
created_principal, created_computer, updated_principal, updated_computer FROM notes;
|
|
19
|
+
INSERT INTO sqlite_sequence(name, seq)
|
|
20
|
+
SELECT 'notes_new', seq FROM sqlite_sequence WHERE name = 'notes'
|
|
21
|
+
AND NOT EXISTS (SELECT 1 FROM sqlite_sequence WHERE name = 'notes_new');
|
|
22
|
+
UPDATE sqlite_sequence SET seq = MAX(seq, COALESCE(
|
|
23
|
+
(SELECT seq FROM sqlite_sequence WHERE name = 'notes'), 0)) WHERE name = 'notes_new';
|
|
24
|
+
DROP TABLE notes;
|
|
25
|
+
ALTER TABLE notes_new RENAME TO notes;
|
|
26
|
+
CREATE INDEX notes_by_update ON notes(updated_at DESC);
|
|
27
|
+
CREATE UNIQUE INDEX shared_note_titles ON notes(project_id, title) WHERE shared = 1;
|
|
28
|
+
CREATE UNIQUE INDEX personal_note_titles ON notes(project_id, created_principal, title)
|
|
29
|
+
WHERE shared = 0;
|
|
30
|
+
CREATE TRIGGER notes_fts_insert AFTER INSERT ON notes BEGIN
|
|
31
|
+
INSERT INTO notes_fts(rowid, title, body, tags) VALUES (new.id, new.title, new.body, new.tags);
|
|
32
|
+
END;
|
|
33
|
+
CREATE TRIGGER notes_fts_delete AFTER DELETE ON notes BEGIN
|
|
34
|
+
INSERT INTO notes_fts(notes_fts, rowid, title, body, tags)
|
|
35
|
+
VALUES ('delete', old.id, old.title, old.body, old.tags);
|
|
36
|
+
END;
|
|
37
|
+
CREATE TRIGGER notes_fts_update AFTER UPDATE ON notes BEGIN
|
|
38
|
+
INSERT INTO notes_fts(notes_fts, rowid, title, body, tags)
|
|
39
|
+
VALUES ('delete', old.id, old.title, old.body, old.tags);
|
|
40
|
+
INSERT INTO notes_fts(rowid, title, body, tags) VALUES (new.id, new.title, new.body, new.tags);
|
|
41
|
+
END;
|
|
42
|
+
INSERT INTO notes_fts(notes_fts) VALUES ('rebuild');
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
@software{minishlab2024model2vec,
|
|
2
|
+
author = {Stephan Tulkens and {van Dongen}, Thomas},
|
|
3
|
+
title = {Model2Vec: Fast State-of-the-Art Static Embeddings},
|
|
4
|
+
year = {2024},
|
|
5
|
+
publisher = {Zenodo},
|
|
6
|
+
doi = {10.5281/zenodo.17270888},
|
|
7
|
+
url = {https://github.com/MinishLab/model2vec},
|
|
8
|
+
license = {MIT}
|
|
9
|
+
}
|
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. We also recommend that a
|
|
186
|
+
file or class name and description of purpose be included on the
|
|
187
|
+
same "printed page" as the copyright notice for easier
|
|
188
|
+
identification within third-party archives.
|
|
189
|
+
|
|
190
|
+
Copyright [yyyy] [name of copyright owner]
|
|
191
|
+
|
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
+
you may not use this file except in compliance with the License.
|
|
194
|
+
You may obtain a copy of the License at
|
|
195
|
+
|
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
+
|
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
+
See the License for the specific language governing permissions and
|
|
202
|
+
limitations under the License.
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
---
|
|
2
|
+
license: apache-2.0
|
|
3
|
+
library_name: model2vec
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Bundled multilingual embeddings
|
|
7
|
+
|
|
8
|
+
Source: [sentence-transformers/static-similarity-mrl-multilingual-v1](https://huggingface.co/sentence-transformers/static-similarity-mrl-multilingual-v1).
|
|
9
|
+
|
|
10
|
+
Converted with Model2Vec: Matryoshka truncation to 512 dimensions, int8 quantization, and normalized output. See `provenance.json` for the pinned revision and checksums, and `UPSTREAM.md` for the original model card.
|
|
11
|
+
|
|
12
|
+
This model is trained for sentence similarity. Backlog search ranks title, body, and tags by cosine similarity; it is not a retrieval-specific model.
|