@fabersep/memory 0.1.0 → 0.2.1

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/dist/src/ui.js ADDED
@@ -0,0 +1,74 @@
1
+ import * as fs from 'node:fs';
2
+ export const DOCS_TROUBLESHOOTING_URL = 'https://github.com/fabersep/memory/blob/main/docs/troubleshooting.md';
3
+ export function troubleshootingLink(anchor) {
4
+ return `${DOCS_TROUBLESHOOTING_URL}#${anchor}`;
5
+ }
6
+ export function shouldUseColor(stream = process.stdout) {
7
+ if (process.env.NO_COLOR !== undefined)
8
+ return false;
9
+ if (process.env.FORCE_COLOR !== undefined && process.env.FORCE_COLOR !== '0')
10
+ return true;
11
+ return Boolean(stream.isTTY);
12
+ }
13
+ function wrap(code, text, enabled = shouldUseColor()) {
14
+ return enabled ? `\x1b[${code}m${text}\x1b[0m` : text;
15
+ }
16
+ export const c = {
17
+ bold: (s, on) => wrap('1', s, on),
18
+ dim: (s, on) => wrap('2', s, on),
19
+ red: (s, on) => wrap('31', s, on),
20
+ green: (s, on) => wrap('32', s, on),
21
+ yellow: (s, on) => wrap('33', s, on),
22
+ blue: (s, on) => wrap('34', s, on),
23
+ magenta: (s, on) => wrap('35', s, on),
24
+ cyan: (s, on) => wrap('36', s, on),
25
+ };
26
+ export function hr(char = '─', width = 64) {
27
+ return char.repeat(width);
28
+ }
29
+ export function normalizeTeamUrl(input) {
30
+ const trimmed = input.trim();
31
+ if (!trimmed)
32
+ return { url: trimmed, normalized: false };
33
+ // Already a full URL or SSH git spec
34
+ if (/^(?:https?|ssh|git|file):\/\//i.test(trimmed) ||
35
+ /^git@[^:]+:.+/.test(trimmed)) {
36
+ return { url: trimmed, normalized: false };
37
+ }
38
+ // Local path (relative, absolute, home, or existing directory)
39
+ if (trimmed.startsWith('/') ||
40
+ trimmed.startsWith('./') ||
41
+ trimmed.startsWith('../') ||
42
+ trimmed.startsWith('~') ||
43
+ fs.existsSync(trimmed)) {
44
+ return { url: trimmed, normalized: false };
45
+ }
46
+ // Host + path without protocol, e.g. github.com/org/repo or gitlab.com/org/repo.git
47
+ if (/^[A-Za-z0-9.-]+\.[A-Za-z]{2,}\/[^/\s]+\/[^/\s]+/.test(trimmed)) {
48
+ const withGit = trimmed.endsWith('.git') ? trimmed : `${trimmed}.git`;
49
+ return { url: `https://${withGit}`, normalized: true };
50
+ }
51
+ // GitHub shorthand: org/repo
52
+ if (/^[A-Za-z0-9._-]+\/[A-Za-z0-9._-]+$/.test(trimmed)) {
53
+ const clean = trimmed.endsWith('.git') ? trimmed : `${trimmed}.git`;
54
+ return { url: `https://github.com/${clean}`, normalized: true };
55
+ }
56
+ return { url: trimmed, normalized: false };
57
+ }
58
+ export function inferErrorAnchor(message) {
59
+ const lower = message.toLowerCase();
60
+ if (lower.includes('machine-path') || lower.includes('home path'))
61
+ return 'machine-specific-paths';
62
+ if (lower.includes('secret') || lower.includes('private key') || lower.includes('api key') || lower.includes('token')) {
63
+ return 'secrets-detected';
64
+ }
65
+ if (lower.includes('budget') || lower.includes('1500'))
66
+ return 'l0-budget-exceeded';
67
+ if (lower.includes('duplicate') || lower.includes('collision'))
68
+ return 'duplicate-ids';
69
+ if (lower.includes('dirty') || lower.includes('uncommitted'))
70
+ return 'dirty-serving-clone';
71
+ if (lower.includes('push') && lower.includes('fail'))
72
+ return 'push-failed';
73
+ return null;
74
+ }
@@ -0,0 +1,2 @@
1
+ /** The installed package version, read from package.json (dist/src/ -> ../../package.json). */
2
+ export declare function getPackageVersion(): string;
@@ -0,0 +1,22 @@
1
+ import * as fs from 'node:fs';
2
+ import * as path from 'node:path';
3
+ import { fileURLToPath } from 'node:url';
4
+ let cached;
5
+ /** The installed package version, read from package.json (dist/src/ -> ../../package.json). */
6
+ export function getPackageVersion() {
7
+ if (cached)
8
+ return cached;
9
+ try {
10
+ const here = path.dirname(fileURLToPath(import.meta.url));
11
+ const raw = JSON.parse(fs.readFileSync(path.resolve(here, '../../package.json'), 'utf8'));
12
+ if (typeof raw.version === 'string' && raw.version.trim()) {
13
+ cached = raw.version.trim();
14
+ return cached;
15
+ }
16
+ }
17
+ catch {
18
+ // Fallback below
19
+ }
20
+ cached = '0.0.0';
21
+ return cached;
22
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fabersep/memory",
3
- "version": "0.1.0",
3
+ "version": "0.2.1",
4
4
  "private": false,
5
5
  "description": "Prefix-cache-first, Git-backed Markdown memory MCP server, pre-memory staging, and import CLI for AI coding agents.",
6
6
  "license": "Apache-2.0",
@@ -31,7 +31,8 @@
31
31
  "files": [
32
32
  "dist/src",
33
33
  "LICENSE",
34
- "README.md"
34
+ "README.md",
35
+ "CHANGELOG.md"
35
36
  ],
36
37
  "engines": {
37
38
  "node": ">=20"