clawvault 3.0.0 → 3.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 +156 -105
- package/bin/clawvault.js +0 -2
- package/bin/register-core-commands.js +20 -2
- package/dist/{chunk-3D6BCTP6.js → chunk-33UGEQRT.js} +70 -145
- package/dist/{chunk-ZVVFWOLW.js → chunk-3WRJEKN4.js} +1 -1
- package/dist/{chunk-DEFFDRVP.js → chunk-3ZIH425O.js} +3 -70
- package/dist/{chunk-K234IDRJ.js → chunk-D2H45LON.js} +1 -0
- package/dist/{chunk-YKTA5JOJ.js → chunk-H62BP7RI.js} +3 -3
- package/dist/{chunk-WGRQ6HDV.js → chunk-LI4O6NVK.js} +1 -1
- package/dist/{chunk-7R7O6STJ.js → chunk-OCGVIN3L.js} +1 -1
- package/dist/{chunk-GAJV4IGR.js → chunk-YCUNCH2I.js} +3 -7
- package/dist/cli/index.cjs +10 -1459
- package/dist/cli/index.js +5 -8
- package/dist/commands/compat.cjs +70 -145
- package/dist/commands/compat.js +1 -1
- package/dist/commands/context.cjs +1 -0
- package/dist/commands/context.js +3 -3
- package/dist/commands/doctor.cjs +68 -144
- package/dist/commands/doctor.js +4 -4
- package/dist/commands/embed.js +2 -2
- package/dist/commands/setup.cjs +2 -69
- package/dist/commands/setup.d.cts +0 -1
- package/dist/commands/setup.d.ts +0 -1
- package/dist/commands/setup.js +2 -2
- package/dist/commands/sleep.cjs +1 -0
- package/dist/commands/sleep.js +2 -2
- package/dist/commands/status.cjs +1 -0
- package/dist/commands/status.js +2 -2
- package/dist/commands/wake.cjs +1 -0
- package/dist/commands/wake.js +2 -2
- package/dist/index.cjs +447 -2600
- package/dist/index.d.cts +0 -4
- package/dist/index.d.ts +0 -4
- package/dist/index.js +8 -69
- package/dist/plugin/index.cjs +3 -3
- package/dist/plugin/index.js +10 -10
- package/package.json +11 -17
- package/bin/register-tailscale-commands.js +0 -106
- package/dist/chunk-IVRIKYFE.js +0 -520
- package/dist/chunk-THRJVD4L.js +0 -373
- package/dist/chunk-TIGW564L.js +0 -628
- package/dist/commands/tailscale.cjs +0 -1532
- package/dist/commands/tailscale.d.cts +0 -52
- package/dist/commands/tailscale.d.ts +0 -52
- package/dist/commands/tailscale.js +0 -26
- package/dist/lib/canvas-layout.cjs +0 -136
- package/dist/lib/canvas-layout.d.cts +0 -31
- package/dist/lib/canvas-layout.d.ts +0 -31
- package/dist/lib/canvas-layout.js +0 -92
- package/dist/lib/tailscale.cjs +0 -1183
- package/dist/lib/tailscale.d.cts +0 -225
- package/dist/lib/tailscale.d.ts +0 -225
- package/dist/lib/tailscale.js +0 -50
- package/dist/lib/webdav.cjs +0 -568
- package/dist/lib/webdav.d.cts +0 -109
- package/dist/lib/webdav.d.ts +0 -109
- package/dist/lib/webdav.js +0 -35
- package/hooks/clawvault/HOOK.md +0 -83
- package/hooks/clawvault/handler.js +0 -879
- package/hooks/clawvault/handler.test.js +0 -354
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import { Command } from 'commander';
|
|
2
|
-
import { TailscalePeer, TailscaleStatus, TailscaleSyncResult } from '../lib/tailscale.cjs';
|
|
3
|
-
import 'child_process';
|
|
4
|
-
import 'http';
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* Tailscale Commands for ClawVault
|
|
8
|
-
*
|
|
9
|
-
* CLI commands for Tailscale-based vault synchronization:
|
|
10
|
-
* - tailscale-status: Show Tailscale connection status and peers
|
|
11
|
-
* - tailscale-sync: Sync vault with a peer on the tailnet
|
|
12
|
-
* - tailscale-serve: Serve vault for sync over Tailscale
|
|
13
|
-
* - tailscale-discover: Discover ClawVault peers on the tailnet
|
|
14
|
-
*/
|
|
15
|
-
|
|
16
|
-
interface TailscaleStatusCommandOptions {
|
|
17
|
-
json?: boolean;
|
|
18
|
-
peers?: boolean;
|
|
19
|
-
}
|
|
20
|
-
interface TailscaleSyncCommandOptions {
|
|
21
|
-
vaultPath?: string;
|
|
22
|
-
peer: string;
|
|
23
|
-
port?: number;
|
|
24
|
-
direction?: 'push' | 'pull' | 'bidirectional';
|
|
25
|
-
dryRun?: boolean;
|
|
26
|
-
deleteOrphans?: boolean;
|
|
27
|
-
categories?: string[];
|
|
28
|
-
https?: boolean;
|
|
29
|
-
json?: boolean;
|
|
30
|
-
}
|
|
31
|
-
interface TailscaleServeCommandOptions {
|
|
32
|
-
vaultPath?: string;
|
|
33
|
-
port?: number;
|
|
34
|
-
funnel?: boolean;
|
|
35
|
-
background?: boolean;
|
|
36
|
-
stop?: boolean;
|
|
37
|
-
}
|
|
38
|
-
interface TailscaleDiscoverCommandOptions {
|
|
39
|
-
port?: number;
|
|
40
|
-
json?: boolean;
|
|
41
|
-
}
|
|
42
|
-
declare function tailscaleStatusCommand(options?: TailscaleStatusCommandOptions): Promise<TailscaleStatus>;
|
|
43
|
-
declare function registerTailscaleStatusCommand(program: Command): void;
|
|
44
|
-
declare function tailscaleSyncCommand(options: TailscaleSyncCommandOptions): Promise<TailscaleSyncResult>;
|
|
45
|
-
declare function registerTailscaleSyncCommand(program: Command): void;
|
|
46
|
-
declare function tailscaleServeCommand(options: TailscaleServeCommandOptions): Promise<void>;
|
|
47
|
-
declare function registerTailscaleServeCommand(program: Command): void;
|
|
48
|
-
declare function tailscaleDiscoverCommand(options?: TailscaleDiscoverCommandOptions): Promise<TailscalePeer[]>;
|
|
49
|
-
declare function registerTailscaleDiscoverCommand(program: Command): void;
|
|
50
|
-
declare function registerTailscaleCommands(program: Command): void;
|
|
51
|
-
|
|
52
|
-
export { type TailscaleDiscoverCommandOptions, type TailscaleServeCommandOptions, type TailscaleStatusCommandOptions, type TailscaleSyncCommandOptions, registerTailscaleCommands, registerTailscaleDiscoverCommand, registerTailscaleServeCommand, registerTailscaleStatusCommand, registerTailscaleSyncCommand, tailscaleDiscoverCommand, tailscaleServeCommand, tailscaleStatusCommand, tailscaleSyncCommand };
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import { Command } from 'commander';
|
|
2
|
-
import { TailscalePeer, TailscaleStatus, TailscaleSyncResult } from '../lib/tailscale.js';
|
|
3
|
-
import 'child_process';
|
|
4
|
-
import 'http';
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* Tailscale Commands for ClawVault
|
|
8
|
-
*
|
|
9
|
-
* CLI commands for Tailscale-based vault synchronization:
|
|
10
|
-
* - tailscale-status: Show Tailscale connection status and peers
|
|
11
|
-
* - tailscale-sync: Sync vault with a peer on the tailnet
|
|
12
|
-
* - tailscale-serve: Serve vault for sync over Tailscale
|
|
13
|
-
* - tailscale-discover: Discover ClawVault peers on the tailnet
|
|
14
|
-
*/
|
|
15
|
-
|
|
16
|
-
interface TailscaleStatusCommandOptions {
|
|
17
|
-
json?: boolean;
|
|
18
|
-
peers?: boolean;
|
|
19
|
-
}
|
|
20
|
-
interface TailscaleSyncCommandOptions {
|
|
21
|
-
vaultPath?: string;
|
|
22
|
-
peer: string;
|
|
23
|
-
port?: number;
|
|
24
|
-
direction?: 'push' | 'pull' | 'bidirectional';
|
|
25
|
-
dryRun?: boolean;
|
|
26
|
-
deleteOrphans?: boolean;
|
|
27
|
-
categories?: string[];
|
|
28
|
-
https?: boolean;
|
|
29
|
-
json?: boolean;
|
|
30
|
-
}
|
|
31
|
-
interface TailscaleServeCommandOptions {
|
|
32
|
-
vaultPath?: string;
|
|
33
|
-
port?: number;
|
|
34
|
-
funnel?: boolean;
|
|
35
|
-
background?: boolean;
|
|
36
|
-
stop?: boolean;
|
|
37
|
-
}
|
|
38
|
-
interface TailscaleDiscoverCommandOptions {
|
|
39
|
-
port?: number;
|
|
40
|
-
json?: boolean;
|
|
41
|
-
}
|
|
42
|
-
declare function tailscaleStatusCommand(options?: TailscaleStatusCommandOptions): Promise<TailscaleStatus>;
|
|
43
|
-
declare function registerTailscaleStatusCommand(program: Command): void;
|
|
44
|
-
declare function tailscaleSyncCommand(options: TailscaleSyncCommandOptions): Promise<TailscaleSyncResult>;
|
|
45
|
-
declare function registerTailscaleSyncCommand(program: Command): void;
|
|
46
|
-
declare function tailscaleServeCommand(options: TailscaleServeCommandOptions): Promise<void>;
|
|
47
|
-
declare function registerTailscaleServeCommand(program: Command): void;
|
|
48
|
-
declare function tailscaleDiscoverCommand(options?: TailscaleDiscoverCommandOptions): Promise<TailscalePeer[]>;
|
|
49
|
-
declare function registerTailscaleDiscoverCommand(program: Command): void;
|
|
50
|
-
declare function registerTailscaleCommands(program: Command): void;
|
|
51
|
-
|
|
52
|
-
export { type TailscaleDiscoverCommandOptions, type TailscaleServeCommandOptions, type TailscaleStatusCommandOptions, type TailscaleSyncCommandOptions, registerTailscaleCommands, registerTailscaleDiscoverCommand, registerTailscaleServeCommand, registerTailscaleStatusCommand, registerTailscaleSyncCommand, tailscaleDiscoverCommand, tailscaleServeCommand, tailscaleStatusCommand, tailscaleSyncCommand };
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
registerTailscaleCommands,
|
|
3
|
-
registerTailscaleDiscoverCommand,
|
|
4
|
-
registerTailscaleServeCommand,
|
|
5
|
-
registerTailscaleStatusCommand,
|
|
6
|
-
registerTailscaleSyncCommand,
|
|
7
|
-
tailscaleDiscoverCommand,
|
|
8
|
-
tailscaleServeCommand,
|
|
9
|
-
tailscaleStatusCommand,
|
|
10
|
-
tailscaleSyncCommand
|
|
11
|
-
} from "../chunk-THRJVD4L.js";
|
|
12
|
-
import "../chunk-TIGW564L.js";
|
|
13
|
-
import "../chunk-IVRIKYFE.js";
|
|
14
|
-
import "../chunk-MXSSG3QU.js";
|
|
15
|
-
import "../chunk-3RG5ZIWI.js";
|
|
16
|
-
export {
|
|
17
|
-
registerTailscaleCommands,
|
|
18
|
-
registerTailscaleDiscoverCommand,
|
|
19
|
-
registerTailscaleServeCommand,
|
|
20
|
-
registerTailscaleStatusCommand,
|
|
21
|
-
registerTailscaleSyncCommand,
|
|
22
|
-
tailscaleDiscoverCommand,
|
|
23
|
-
tailscaleServeCommand,
|
|
24
|
-
tailscaleStatusCommand,
|
|
25
|
-
tailscaleSyncCommand
|
|
26
|
-
};
|
|
@@ -1,136 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __create = Object.create;
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __export = (target, all) => {
|
|
9
|
-
for (var name in all)
|
|
10
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
-
};
|
|
12
|
-
var __copyProps = (to, from, except, desc) => {
|
|
13
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
-
for (let key of __getOwnPropNames(from))
|
|
15
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
-
}
|
|
18
|
-
return to;
|
|
19
|
-
};
|
|
20
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
-
mod
|
|
27
|
-
));
|
|
28
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
-
|
|
30
|
-
// src/lib/canvas-layout.ts
|
|
31
|
-
var canvas_layout_exports = {};
|
|
32
|
-
__export(canvas_layout_exports, {
|
|
33
|
-
CANVAS_COLORS: () => CANVAS_COLORS,
|
|
34
|
-
LAYOUT: () => LAYOUT,
|
|
35
|
-
createEdge: () => createEdge,
|
|
36
|
-
createFileNode: () => createFileNode,
|
|
37
|
-
createGroupNode: () => createGroupNode,
|
|
38
|
-
createGroupWithNodes: () => createGroupWithNodes,
|
|
39
|
-
createTextNode: () => createTextNode,
|
|
40
|
-
formatCanvasText: () => formatCanvasText,
|
|
41
|
-
generateId: () => generateId,
|
|
42
|
-
getPriorityColor: () => getPriorityColor,
|
|
43
|
-
stackNodesVertically: () => stackNodesVertically,
|
|
44
|
-
truncateText: () => truncateText
|
|
45
|
-
});
|
|
46
|
-
module.exports = __toCommonJS(canvas_layout_exports);
|
|
47
|
-
var crypto = __toESM(require("crypto"), 1);
|
|
48
|
-
var CANVAS_COLORS = {
|
|
49
|
-
RED: "1",
|
|
50
|
-
ORANGE: "2",
|
|
51
|
-
YELLOW: "3",
|
|
52
|
-
GREEN: "4",
|
|
53
|
-
CYAN: "5",
|
|
54
|
-
PURPLE: "6"
|
|
55
|
-
};
|
|
56
|
-
var LAYOUT = {
|
|
57
|
-
GROUP_PADDING: 20,
|
|
58
|
-
NODE_SPACING: 10,
|
|
59
|
-
HEADER_HEIGHT: 40
|
|
60
|
-
};
|
|
61
|
-
function generateId() {
|
|
62
|
-
return crypto.randomBytes(8).toString("hex");
|
|
63
|
-
}
|
|
64
|
-
function createTextNode(x, y, width, height, text, color) {
|
|
65
|
-
const node = { id: generateId(), type: "text", x, y, width, height, text };
|
|
66
|
-
if (color !== void 0) node.color = color;
|
|
67
|
-
return node;
|
|
68
|
-
}
|
|
69
|
-
function createFileNode(x, y, width, height, file, color) {
|
|
70
|
-
const node = { id: generateId(), type: "file", x, y, width, height, file };
|
|
71
|
-
if (color !== void 0) node.color = color;
|
|
72
|
-
return node;
|
|
73
|
-
}
|
|
74
|
-
function createGroupNode(x, y, width, height, label, color) {
|
|
75
|
-
const node = { id: generateId(), type: "group", x, y, width, height, label };
|
|
76
|
-
if (color !== void 0) node.color = color;
|
|
77
|
-
return node;
|
|
78
|
-
}
|
|
79
|
-
function createEdge(fromNode, fromSide, toNode, toSide, label, color) {
|
|
80
|
-
const edge = { id: generateId(), fromNode, fromSide, toNode, toSide };
|
|
81
|
-
if (label !== void 0) edge.label = label;
|
|
82
|
-
if (color !== void 0) edge.color = color;
|
|
83
|
-
return edge;
|
|
84
|
-
}
|
|
85
|
-
function stackNodesVertically(nodes, startX, startY, spacing) {
|
|
86
|
-
let currentY = startY;
|
|
87
|
-
const positioned = nodes.map((node) => {
|
|
88
|
-
const n = { ...node, x: startX, y: currentY };
|
|
89
|
-
currentY += node.height + spacing;
|
|
90
|
-
return n;
|
|
91
|
-
});
|
|
92
|
-
return { nodes: positioned, totalHeight: currentY - startY - spacing };
|
|
93
|
-
}
|
|
94
|
-
function createGroupWithNodes(x, y, width, label, childNodes, color) {
|
|
95
|
-
const padding = LAYOUT.GROUP_PADDING;
|
|
96
|
-
const headerHeight = LAYOUT.HEADER_HEIGHT;
|
|
97
|
-
const spacing = LAYOUT.NODE_SPACING;
|
|
98
|
-
const { nodes, totalHeight } = stackNodesVertically(childNodes, x + padding, y + headerHeight, spacing);
|
|
99
|
-
const groupHeight = headerHeight + totalHeight + padding;
|
|
100
|
-
const group = createGroupNode(x, y, width, Math.max(groupHeight, 100), label, color);
|
|
101
|
-
return { group, nodes };
|
|
102
|
-
}
|
|
103
|
-
function getPriorityColor(priority) {
|
|
104
|
-
switch (priority) {
|
|
105
|
-
case "critical":
|
|
106
|
-
return CANVAS_COLORS.RED;
|
|
107
|
-
case "high":
|
|
108
|
-
return CANVAS_COLORS.ORANGE;
|
|
109
|
-
case "medium":
|
|
110
|
-
return CANVAS_COLORS.YELLOW;
|
|
111
|
-
default:
|
|
112
|
-
return void 0;
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
function truncateText(text, maxLength) {
|
|
116
|
-
if (text.length <= maxLength) return text;
|
|
117
|
-
return text.slice(0, maxLength - 3) + "...";
|
|
118
|
-
}
|
|
119
|
-
function formatCanvasText(lines) {
|
|
120
|
-
return lines.join("\n");
|
|
121
|
-
}
|
|
122
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
123
|
-
0 && (module.exports = {
|
|
124
|
-
CANVAS_COLORS,
|
|
125
|
-
LAYOUT,
|
|
126
|
-
createEdge,
|
|
127
|
-
createFileNode,
|
|
128
|
-
createGroupNode,
|
|
129
|
-
createGroupWithNodes,
|
|
130
|
-
createTextNode,
|
|
131
|
-
formatCanvasText,
|
|
132
|
-
generateId,
|
|
133
|
-
getPriorityColor,
|
|
134
|
-
stackNodesVertically,
|
|
135
|
-
truncateText
|
|
136
|
-
});
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
declare const CANVAS_COLORS: {
|
|
2
|
-
readonly RED: "1";
|
|
3
|
-
readonly ORANGE: "2";
|
|
4
|
-
readonly YELLOW: "3";
|
|
5
|
-
readonly GREEN: "4";
|
|
6
|
-
readonly CYAN: "5";
|
|
7
|
-
readonly PURPLE: "6";
|
|
8
|
-
};
|
|
9
|
-
declare const LAYOUT: {
|
|
10
|
-
readonly GROUP_PADDING: 20;
|
|
11
|
-
readonly NODE_SPACING: 10;
|
|
12
|
-
readonly HEADER_HEIGHT: 40;
|
|
13
|
-
};
|
|
14
|
-
declare function generateId(): string;
|
|
15
|
-
declare function createTextNode(x: number, y: number, width: number, height: number, text: string, color?: string): any;
|
|
16
|
-
declare function createFileNode(x: number, y: number, width: number, height: number, file: string, color?: string): any;
|
|
17
|
-
declare function createGroupNode(x: number, y: number, width: number, height: number, label: string, color?: string): any;
|
|
18
|
-
declare function createEdge(fromNode: string, fromSide: string, toNode: string, toSide: string, label?: string, color?: string): any;
|
|
19
|
-
declare function stackNodesVertically(nodes: any[], startX: number, startY: number, spacing: number): {
|
|
20
|
-
nodes: any[];
|
|
21
|
-
totalHeight: number;
|
|
22
|
-
};
|
|
23
|
-
declare function createGroupWithNodes(x: number, y: number, width: number, label: string, childNodes: any[], color?: string): {
|
|
24
|
-
group: any;
|
|
25
|
-
nodes: any[];
|
|
26
|
-
};
|
|
27
|
-
declare function getPriorityColor(priority: string | undefined): string | undefined;
|
|
28
|
-
declare function truncateText(text: string, maxLength: number): string;
|
|
29
|
-
declare function formatCanvasText(lines: string[]): string;
|
|
30
|
-
|
|
31
|
-
export { CANVAS_COLORS, LAYOUT, createEdge, createFileNode, createGroupNode, createGroupWithNodes, createTextNode, formatCanvasText, generateId, getPriorityColor, stackNodesVertically, truncateText };
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
declare const CANVAS_COLORS: {
|
|
2
|
-
readonly RED: "1";
|
|
3
|
-
readonly ORANGE: "2";
|
|
4
|
-
readonly YELLOW: "3";
|
|
5
|
-
readonly GREEN: "4";
|
|
6
|
-
readonly CYAN: "5";
|
|
7
|
-
readonly PURPLE: "6";
|
|
8
|
-
};
|
|
9
|
-
declare const LAYOUT: {
|
|
10
|
-
readonly GROUP_PADDING: 20;
|
|
11
|
-
readonly NODE_SPACING: 10;
|
|
12
|
-
readonly HEADER_HEIGHT: 40;
|
|
13
|
-
};
|
|
14
|
-
declare function generateId(): string;
|
|
15
|
-
declare function createTextNode(x: number, y: number, width: number, height: number, text: string, color?: string): any;
|
|
16
|
-
declare function createFileNode(x: number, y: number, width: number, height: number, file: string, color?: string): any;
|
|
17
|
-
declare function createGroupNode(x: number, y: number, width: number, height: number, label: string, color?: string): any;
|
|
18
|
-
declare function createEdge(fromNode: string, fromSide: string, toNode: string, toSide: string, label?: string, color?: string): any;
|
|
19
|
-
declare function stackNodesVertically(nodes: any[], startX: number, startY: number, spacing: number): {
|
|
20
|
-
nodes: any[];
|
|
21
|
-
totalHeight: number;
|
|
22
|
-
};
|
|
23
|
-
declare function createGroupWithNodes(x: number, y: number, width: number, label: string, childNodes: any[], color?: string): {
|
|
24
|
-
group: any;
|
|
25
|
-
nodes: any[];
|
|
26
|
-
};
|
|
27
|
-
declare function getPriorityColor(priority: string | undefined): string | undefined;
|
|
28
|
-
declare function truncateText(text: string, maxLength: number): string;
|
|
29
|
-
declare function formatCanvasText(lines: string[]): string;
|
|
30
|
-
|
|
31
|
-
export { CANVAS_COLORS, LAYOUT, createEdge, createFileNode, createGroupNode, createGroupWithNodes, createTextNode, formatCanvasText, generateId, getPriorityColor, stackNodesVertically, truncateText };
|
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
import "../chunk-3RG5ZIWI.js";
|
|
2
|
-
|
|
3
|
-
// src/lib/canvas-layout.ts
|
|
4
|
-
import * as crypto from "crypto";
|
|
5
|
-
var CANVAS_COLORS = {
|
|
6
|
-
RED: "1",
|
|
7
|
-
ORANGE: "2",
|
|
8
|
-
YELLOW: "3",
|
|
9
|
-
GREEN: "4",
|
|
10
|
-
CYAN: "5",
|
|
11
|
-
PURPLE: "6"
|
|
12
|
-
};
|
|
13
|
-
var LAYOUT = {
|
|
14
|
-
GROUP_PADDING: 20,
|
|
15
|
-
NODE_SPACING: 10,
|
|
16
|
-
HEADER_HEIGHT: 40
|
|
17
|
-
};
|
|
18
|
-
function generateId() {
|
|
19
|
-
return crypto.randomBytes(8).toString("hex");
|
|
20
|
-
}
|
|
21
|
-
function createTextNode(x, y, width, height, text, color) {
|
|
22
|
-
const node = { id: generateId(), type: "text", x, y, width, height, text };
|
|
23
|
-
if (color !== void 0) node.color = color;
|
|
24
|
-
return node;
|
|
25
|
-
}
|
|
26
|
-
function createFileNode(x, y, width, height, file, color) {
|
|
27
|
-
const node = { id: generateId(), type: "file", x, y, width, height, file };
|
|
28
|
-
if (color !== void 0) node.color = color;
|
|
29
|
-
return node;
|
|
30
|
-
}
|
|
31
|
-
function createGroupNode(x, y, width, height, label, color) {
|
|
32
|
-
const node = { id: generateId(), type: "group", x, y, width, height, label };
|
|
33
|
-
if (color !== void 0) node.color = color;
|
|
34
|
-
return node;
|
|
35
|
-
}
|
|
36
|
-
function createEdge(fromNode, fromSide, toNode, toSide, label, color) {
|
|
37
|
-
const edge = { id: generateId(), fromNode, fromSide, toNode, toSide };
|
|
38
|
-
if (label !== void 0) edge.label = label;
|
|
39
|
-
if (color !== void 0) edge.color = color;
|
|
40
|
-
return edge;
|
|
41
|
-
}
|
|
42
|
-
function stackNodesVertically(nodes, startX, startY, spacing) {
|
|
43
|
-
let currentY = startY;
|
|
44
|
-
const positioned = nodes.map((node) => {
|
|
45
|
-
const n = { ...node, x: startX, y: currentY };
|
|
46
|
-
currentY += node.height + spacing;
|
|
47
|
-
return n;
|
|
48
|
-
});
|
|
49
|
-
return { nodes: positioned, totalHeight: currentY - startY - spacing };
|
|
50
|
-
}
|
|
51
|
-
function createGroupWithNodes(x, y, width, label, childNodes, color) {
|
|
52
|
-
const padding = LAYOUT.GROUP_PADDING;
|
|
53
|
-
const headerHeight = LAYOUT.HEADER_HEIGHT;
|
|
54
|
-
const spacing = LAYOUT.NODE_SPACING;
|
|
55
|
-
const { nodes, totalHeight } = stackNodesVertically(childNodes, x + padding, y + headerHeight, spacing);
|
|
56
|
-
const groupHeight = headerHeight + totalHeight + padding;
|
|
57
|
-
const group = createGroupNode(x, y, width, Math.max(groupHeight, 100), label, color);
|
|
58
|
-
return { group, nodes };
|
|
59
|
-
}
|
|
60
|
-
function getPriorityColor(priority) {
|
|
61
|
-
switch (priority) {
|
|
62
|
-
case "critical":
|
|
63
|
-
return CANVAS_COLORS.RED;
|
|
64
|
-
case "high":
|
|
65
|
-
return CANVAS_COLORS.ORANGE;
|
|
66
|
-
case "medium":
|
|
67
|
-
return CANVAS_COLORS.YELLOW;
|
|
68
|
-
default:
|
|
69
|
-
return void 0;
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
function truncateText(text, maxLength) {
|
|
73
|
-
if (text.length <= maxLength) return text;
|
|
74
|
-
return text.slice(0, maxLength - 3) + "...";
|
|
75
|
-
}
|
|
76
|
-
function formatCanvasText(lines) {
|
|
77
|
-
return lines.join("\n");
|
|
78
|
-
}
|
|
79
|
-
export {
|
|
80
|
-
CANVAS_COLORS,
|
|
81
|
-
LAYOUT,
|
|
82
|
-
createEdge,
|
|
83
|
-
createFileNode,
|
|
84
|
-
createGroupNode,
|
|
85
|
-
createGroupWithNodes,
|
|
86
|
-
createTextNode,
|
|
87
|
-
formatCanvasText,
|
|
88
|
-
generateId,
|
|
89
|
-
getPriorityColor,
|
|
90
|
-
stackNodesVertically,
|
|
91
|
-
truncateText
|
|
92
|
-
};
|