@hailer/mcp 0.0.5 → 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/.claude/agents/ada.md +127 -0
- package/.claude/agents/agent-builder.md +151 -0
- package/.claude/agents/alejandro.md +66 -0
- package/.claude/agents/bjorn.md +305 -0
- package/.claude/agents/dmitri.md +61 -0
- package/.claude/agents/giuseppe.md +66 -0
- package/.claude/agents/gunther.md +355 -0
- package/.claude/agents/helga.md +68 -0
- package/.claude/agents/kenji.md +58 -0
- package/.claude/agents/svetlana.md +394 -0
- package/.claude/agents/viktor.md +63 -0
- package/.claude/agents/yevgeni.md +60 -0
- package/.claude/hooks/agent-failure-detector.cjs +286 -0
- package/.claude/hooks/app-edit-guard.cjs +462 -0
- package/.claude/hooks/interactive-mode.cjs +59 -0
- package/.claude/hooks/mcp-server-guard.cjs +92 -0
- package/.claude/hooks/post-scaffold-hook.cjs +31 -0
- package/.claude/hooks/src-edit-guard.cjs +208 -0
- package/.claude/settings.json +47 -2
- package/.claude/skills/insight-join-patterns/SKILL.md +209 -0
- package/.env.example +13 -1
- package/CLAUDE.md +134 -0
- package/dist/app.js +4 -3
- package/dist/cli.js +0 -0
- package/dist/client/adaptive-documentation-bot.d.ts +0 -2
- package/dist/client/adaptive-documentation-bot.js +5 -16
- package/dist/client/message-processor.js +5 -0
- package/dist/client/providers/anthropic-provider.js +21 -7
- package/dist/mcp/UserContextCache.d.ts +14 -0
- package/dist/mcp/UserContextCache.js +49 -24
- package/dist/mcp/auth.d.ts +7 -0
- package/dist/mcp/auth.js +13 -5
- package/dist/mcp/hailer-clients.d.ts +5 -2
- package/dist/mcp/signal-handler.d.ts +28 -2
- package/dist/mcp/signal-handler.js +4 -2
- package/dist/mcp/tool-registry.d.ts +55 -2
- package/dist/mcp/tool-registry.js +197 -2
- package/dist/mcp/tools/app-core.d.ts +15 -0
- package/dist/mcp/tools/app-core.js +609 -0
- package/dist/mcp/tools/app-marketplace.d.ts +21 -0
- package/dist/mcp/tools/app-marketplace.js +1284 -0
- package/dist/mcp/tools/app-member.d.ts +11 -0
- package/dist/mcp/tools/app-member.js +258 -0
- package/dist/mcp/tools/app-scaffold.d.ts +11 -0
- package/dist/mcp/tools/app-scaffold.js +743 -0
- package/dist/mcp/tools/app.d.ts +13 -22
- package/dist/mcp/tools/app.js +17 -2466
- package/dist/mcp/tools/file.js +6 -6
- package/dist/mcp/tools/insight.d.ts +1 -0
- package/dist/mcp/tools/insight.js +203 -64
- package/dist/mcp/tools/user.js +3 -9
- package/dist/mcp/tools/workflow.js +49 -38
- package/dist/mcp/utils/hailer-api-client.js +4 -13
- package/dist/mcp/utils/tool-helpers.d.ts +102 -0
- package/dist/mcp/utils/tool-helpers.js +179 -0
- package/dist/mcp/utils/types.d.ts +6 -0
- package/dist/mcp/workspace-cache.d.ts +5 -5
- package/dist/mcp/workspace-cache.js +4 -3
- package/package.json +1 -1
- package/.claude/hooks/PreToolUse.sh +0 -52
- package/.claude/hooks/prompt-skill-loader.cjs +0 -553
- package/.claude/hooks/skill-loader.cjs +0 -142
- package/.claude/settings.local.json +0 -49
- package/.claude/skills/MCP-add-app-member-skill/SKILL.md +0 -977
- package/.claude/skills/MCP-build-data-app-skill/SKILL.md +0 -372
- package/.claude/skills/MCP-create-app-skill/SKILL.md +0 -1101
- package/.claude/skills/MCP-create-insight-skill/SKILL.md +0 -1317
- package/.claude/skills/MCP-get-insight-data-skill/SKILL.md +0 -1053
- package/.claude/skills/MCP-insight-api/SKILL.md +0 -185
- package/.claude/skills/MCP-insight-api/references/insight-endpoints.md +0 -514
- package/.claude/skills/MCP-install-workflow-skill/SKILL.md +0 -1056
- package/.claude/skills/MCP-list-apps-skill/SKILL.md +0 -1010
- package/.claude/skills/MCP-list-workflows-minimal-skill/SKILL.md +0 -992
- package/.claude/skills/MCP-local-first-skill/SKILL.md +0 -570
- package/.claude/skills/MCP-populate-workflow-data-skill/SKILL.md +0 -395
- package/.claude/skills/MCP-preview-insight-skill/SKILL.md +0 -1290
- package/.claude/skills/MCP-publish-hailer-app-skill/SKILL.md +0 -453
- package/.claude/skills/MCP-publish-template-skill/SKILL.md +0 -278
- package/.claude/skills/MCP-remove-app-member-skill/SKILL.md +0 -671
- package/.claude/skills/MCP-remove-app-skill/SKILL.md +0 -985
- package/.claude/skills/MCP-remove-insight-skill/SKILL.md +0 -1011
- package/.claude/skills/MCP-remove-workflow-skill/SKILL.md +0 -920
- package/.claude/skills/MCP-scaffold-hailer-app-skill/SKILL.md +0 -1237
- package/.claude/skills/MCP-update-app-skill/SKILL.md +0 -970
- package/.claude/skills/MCP-update-workflow-field-skill/SKILL.md +0 -1098
- package/.claude/skills/SDK-create-function-field-skill/SKILL.md +0 -313
- package/.claude/skills/SDK-generate-skill/SKILL.md +0 -223
- package/.claude/skills/SDK-init-skill/SKILL.md +0 -177
- package/.claude/skills/SDK-workspace-setup-skill/SKILL.md +0 -605
- package/.claude/skills/SDK-ws-config-skill/SKILL.md +0 -435
- package/.claude/skills/activity-api/SKILL.md +0 -96
- package/.claude/skills/activity-api/references/activity-endpoints.md +0 -845
- package/.claude/skills/agent-building/SKILL.md +0 -243
- package/.claude/skills/agent-building/references/architecture-patterns.md +0 -446
- package/.claude/skills/agent-building/references/code-examples.md +0 -587
- package/.claude/skills/agent-building/references/implementation-guide.md +0 -619
- package/.claude/skills/app-api/SKILL.md +0 -219
- package/.claude/skills/app-api/references/app-endpoints.md +0 -759
- package/.claude/skills/building-hailer-apps-skill/SKILL.md +0 -813
- package/.claude/skills/hailer-api/SKILL.md +0 -283
- package/.claude/skills/hailer-api/references/activities.md +0 -620
- package/.claude/skills/hailer-api/references/authentication.md +0 -216
- package/.claude/skills/hailer-api/references/datasets.md +0 -437
- package/.claude/skills/hailer-api/references/files.md +0 -301
- package/.claude/skills/hailer-api/references/insights.md +0 -469
- package/.claude/skills/hailer-api/references/workflows.md +0 -720
- package/.claude/skills/hailer-api/references/workspaces-users.md +0 -445
- package/.claude/skills/hailer-app-builder/SKILL.md +0 -340
- package/.claude/skills/mcp-tools/SKILL.md +0 -419
- package/.claude/skills/mcp-tools/references/api-endpoints.md +0 -499
- package/.claude/skills/mcp-tools/references/data-structures.md +0 -554
- package/.claude/skills/mcp-tools/references/implementation-patterns.md +0 -717
- package/.claude/skills/skill-testing/README.md +0 -137
- package/.claude/skills/skill-testing/SKILL.md +0 -348
- package/.claude/skills/skill-testing/references/test-patterns.md +0 -705
- package/.claude/skills/skill-testing/references/testing-guide.md +0 -603
- package/.claude/skills/skill-testing/references/validation-checklist.md +0 -537
- package/.claude/skills/spawn-app-builder/SKILL.md +0 -366
- package/.claude/skills/tool-builder/SKILL.md +0 -328
- package/tsconfig.json +0 -23
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tool Helper Utilities
|
|
3
|
+
*
|
|
4
|
+
* Centralized utilities for common tool operations to reduce code duplication.
|
|
5
|
+
*/
|
|
6
|
+
import { UserContext } from '../UserContextCache';
|
|
7
|
+
import { WorkspaceCache } from '../workspace-cache';
|
|
8
|
+
import { McpResponse } from './types';
|
|
9
|
+
/**
|
|
10
|
+
* Error thrown when workspace cache is not available
|
|
11
|
+
*/
|
|
12
|
+
export declare class MissingWorkspaceCacheError extends Error {
|
|
13
|
+
constructor();
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Requires workspace cache to be available, throws if not.
|
|
17
|
+
* Use this when workspace cache is mandatory for the operation.
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* ```typescript
|
|
21
|
+
* const cache = requireWorkspaceCache(context);
|
|
22
|
+
* // cache is guaranteed to be non-null here
|
|
23
|
+
* ```
|
|
24
|
+
*/
|
|
25
|
+
export declare function requireWorkspaceCache(context: UserContext): WorkspaceCache;
|
|
26
|
+
/**
|
|
27
|
+
* Creates a standard error response for missing workspace cache.
|
|
28
|
+
* Use this for tools that need workspace cache but want to return an error response
|
|
29
|
+
* instead of throwing.
|
|
30
|
+
*/
|
|
31
|
+
export declare function missingWorkspaceCacheResponse(): McpResponse;
|
|
32
|
+
/**
|
|
33
|
+
* Gets the resolved workspace ID from args or defaults to current workspace.
|
|
34
|
+
* Combines workspace cache check and ID resolution into one call.
|
|
35
|
+
*
|
|
36
|
+
* @param args - Arguments object that may contain workspaceId
|
|
37
|
+
* @param context - User context with workspace cache
|
|
38
|
+
* @returns Resolved workspace ID or undefined if cache unavailable
|
|
39
|
+
*
|
|
40
|
+
* @example
|
|
41
|
+
* ```typescript
|
|
42
|
+
* const workspaceId = getResolvedWorkspaceId(args, context);
|
|
43
|
+
* if (!workspaceId) {
|
|
44
|
+
* return missingWorkspaceCacheResponse();
|
|
45
|
+
* }
|
|
46
|
+
* ```
|
|
47
|
+
*/
|
|
48
|
+
export declare function getResolvedWorkspaceId(args: {
|
|
49
|
+
workspaceId?: string;
|
|
50
|
+
}, context: UserContext): string | undefined;
|
|
51
|
+
/**
|
|
52
|
+
* Gets the resolved workspace ID, throwing if workspace cache is unavailable.
|
|
53
|
+
* Use this when workspace cache is mandatory for the operation.
|
|
54
|
+
*
|
|
55
|
+
* @param args - Arguments object that may contain workspaceId
|
|
56
|
+
* @param context - User context with workspace cache
|
|
57
|
+
* @returns Resolved workspace ID (guaranteed non-undefined)
|
|
58
|
+
* @throws MissingWorkspaceCacheError if workspace cache is unavailable
|
|
59
|
+
*
|
|
60
|
+
* @example
|
|
61
|
+
* ```typescript
|
|
62
|
+
* try {
|
|
63
|
+
* const workspaceId = getRequiredWorkspaceId(args, context);
|
|
64
|
+
* // workspaceId is guaranteed to be a string
|
|
65
|
+
* } catch (error) {
|
|
66
|
+
* if (error instanceof MissingWorkspaceCacheError) {
|
|
67
|
+
* return missingWorkspaceCacheResponse();
|
|
68
|
+
* }
|
|
69
|
+
* throw error;
|
|
70
|
+
* }
|
|
71
|
+
* ```
|
|
72
|
+
*/
|
|
73
|
+
export declare function getRequiredWorkspaceId(args: {
|
|
74
|
+
workspaceId?: string;
|
|
75
|
+
}, context: UserContext): string;
|
|
76
|
+
/**
|
|
77
|
+
* Extracts a human-readable error message from an unknown error.
|
|
78
|
+
* Handles Error instances, objects with message properties, and primitives.
|
|
79
|
+
*
|
|
80
|
+
* @param error - The error to extract message from
|
|
81
|
+
* @returns Human-readable error message string
|
|
82
|
+
*
|
|
83
|
+
* @example
|
|
84
|
+
* ```typescript
|
|
85
|
+
* try {
|
|
86
|
+
* await someOperation();
|
|
87
|
+
* } catch (error) {
|
|
88
|
+
* const message = extractErrorMessage(error);
|
|
89
|
+
* return errorResponse(`Operation failed: ${message}`);
|
|
90
|
+
* }
|
|
91
|
+
* ```
|
|
92
|
+
*/
|
|
93
|
+
export declare function extractErrorMessage(error: unknown): string;
|
|
94
|
+
/**
|
|
95
|
+
* Creates a standard success response with formatted text.
|
|
96
|
+
*/
|
|
97
|
+
export declare function successResponse(text: string): McpResponse;
|
|
98
|
+
/**
|
|
99
|
+
* Creates a standard error response with formatted text.
|
|
100
|
+
*/
|
|
101
|
+
export declare function errorResponse(text: string): McpResponse;
|
|
102
|
+
//# sourceMappingURL=tool-helpers.d.ts.map
|
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Tool Helper Utilities
|
|
4
|
+
*
|
|
5
|
+
* Centralized utilities for common tool operations to reduce code duplication.
|
|
6
|
+
*/
|
|
7
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
+
exports.MissingWorkspaceCacheError = void 0;
|
|
9
|
+
exports.requireWorkspaceCache = requireWorkspaceCache;
|
|
10
|
+
exports.missingWorkspaceCacheResponse = missingWorkspaceCacheResponse;
|
|
11
|
+
exports.getResolvedWorkspaceId = getResolvedWorkspaceId;
|
|
12
|
+
exports.getRequiredWorkspaceId = getRequiredWorkspaceId;
|
|
13
|
+
exports.extractErrorMessage = extractErrorMessage;
|
|
14
|
+
exports.successResponse = successResponse;
|
|
15
|
+
exports.errorResponse = errorResponse;
|
|
16
|
+
const workspace_cache_1 = require("../workspace-cache");
|
|
17
|
+
/**
|
|
18
|
+
* Error thrown when workspace cache is not available
|
|
19
|
+
*/
|
|
20
|
+
class MissingWorkspaceCacheError extends Error {
|
|
21
|
+
constructor() {
|
|
22
|
+
super('Workspace cache not available');
|
|
23
|
+
this.name = 'MissingWorkspaceCacheError';
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
exports.MissingWorkspaceCacheError = MissingWorkspaceCacheError;
|
|
27
|
+
/**
|
|
28
|
+
* Requires workspace cache to be available, throws if not.
|
|
29
|
+
* Use this when workspace cache is mandatory for the operation.
|
|
30
|
+
*
|
|
31
|
+
* @example
|
|
32
|
+
* ```typescript
|
|
33
|
+
* const cache = requireWorkspaceCache(context);
|
|
34
|
+
* // cache is guaranteed to be non-null here
|
|
35
|
+
* ```
|
|
36
|
+
*/
|
|
37
|
+
function requireWorkspaceCache(context) {
|
|
38
|
+
if (!context.workspaceCache) {
|
|
39
|
+
throw new MissingWorkspaceCacheError();
|
|
40
|
+
}
|
|
41
|
+
return context.workspaceCache;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Creates a standard error response for missing workspace cache.
|
|
45
|
+
* Use this for tools that need workspace cache but want to return an error response
|
|
46
|
+
* instead of throwing.
|
|
47
|
+
*/
|
|
48
|
+
function missingWorkspaceCacheResponse() {
|
|
49
|
+
return {
|
|
50
|
+
content: [{
|
|
51
|
+
type: "text",
|
|
52
|
+
text: "Workspace cache not available",
|
|
53
|
+
}],
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Gets the resolved workspace ID from args or defaults to current workspace.
|
|
58
|
+
* Combines workspace cache check and ID resolution into one call.
|
|
59
|
+
*
|
|
60
|
+
* @param args - Arguments object that may contain workspaceId
|
|
61
|
+
* @param context - User context with workspace cache
|
|
62
|
+
* @returns Resolved workspace ID or undefined if cache unavailable
|
|
63
|
+
*
|
|
64
|
+
* @example
|
|
65
|
+
* ```typescript
|
|
66
|
+
* const workspaceId = getResolvedWorkspaceId(args, context);
|
|
67
|
+
* if (!workspaceId) {
|
|
68
|
+
* return missingWorkspaceCacheResponse();
|
|
69
|
+
* }
|
|
70
|
+
* ```
|
|
71
|
+
*/
|
|
72
|
+
function getResolvedWorkspaceId(args, context) {
|
|
73
|
+
if (!context.workspaceCache) {
|
|
74
|
+
return undefined;
|
|
75
|
+
}
|
|
76
|
+
if (args.workspaceId) {
|
|
77
|
+
return (0, workspace_cache_1.resolveWorkspaceId)(context.workspaceCache, args.workspaceId);
|
|
78
|
+
}
|
|
79
|
+
return context.workspaceCache.currentWorkspace._id;
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Gets the resolved workspace ID, throwing if workspace cache is unavailable.
|
|
83
|
+
* Use this when workspace cache is mandatory for the operation.
|
|
84
|
+
*
|
|
85
|
+
* @param args - Arguments object that may contain workspaceId
|
|
86
|
+
* @param context - User context with workspace cache
|
|
87
|
+
* @returns Resolved workspace ID (guaranteed non-undefined)
|
|
88
|
+
* @throws MissingWorkspaceCacheError if workspace cache is unavailable
|
|
89
|
+
*
|
|
90
|
+
* @example
|
|
91
|
+
* ```typescript
|
|
92
|
+
* try {
|
|
93
|
+
* const workspaceId = getRequiredWorkspaceId(args, context);
|
|
94
|
+
* // workspaceId is guaranteed to be a string
|
|
95
|
+
* } catch (error) {
|
|
96
|
+
* if (error instanceof MissingWorkspaceCacheError) {
|
|
97
|
+
* return missingWorkspaceCacheResponse();
|
|
98
|
+
* }
|
|
99
|
+
* throw error;
|
|
100
|
+
* }
|
|
101
|
+
* ```
|
|
102
|
+
*/
|
|
103
|
+
function getRequiredWorkspaceId(args, context) {
|
|
104
|
+
const cache = requireWorkspaceCache(context);
|
|
105
|
+
if (args.workspaceId) {
|
|
106
|
+
const resolved = (0, workspace_cache_1.resolveWorkspaceId)(cache, args.workspaceId);
|
|
107
|
+
if (!resolved) {
|
|
108
|
+
throw new Error(`Workspace not found: ${args.workspaceId}`);
|
|
109
|
+
}
|
|
110
|
+
return resolved;
|
|
111
|
+
}
|
|
112
|
+
return cache.currentWorkspace._id;
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* Extracts a human-readable error message from an unknown error.
|
|
116
|
+
* Handles Error instances, objects with message properties, and primitives.
|
|
117
|
+
*
|
|
118
|
+
* @param error - The error to extract message from
|
|
119
|
+
* @returns Human-readable error message string
|
|
120
|
+
*
|
|
121
|
+
* @example
|
|
122
|
+
* ```typescript
|
|
123
|
+
* try {
|
|
124
|
+
* await someOperation();
|
|
125
|
+
* } catch (error) {
|
|
126
|
+
* const message = extractErrorMessage(error);
|
|
127
|
+
* return errorResponse(`Operation failed: ${message}`);
|
|
128
|
+
* }
|
|
129
|
+
* ```
|
|
130
|
+
*/
|
|
131
|
+
function extractErrorMessage(error) {
|
|
132
|
+
if (error instanceof Error) {
|
|
133
|
+
return error.message;
|
|
134
|
+
}
|
|
135
|
+
if (error && typeof error === 'object') {
|
|
136
|
+
// Check for common error object shapes
|
|
137
|
+
const errorObj = error;
|
|
138
|
+
if (typeof errorObj.message === 'string') {
|
|
139
|
+
return errorObj.message;
|
|
140
|
+
}
|
|
141
|
+
if (typeof errorObj.error === 'string') {
|
|
142
|
+
return errorObj.error;
|
|
143
|
+
}
|
|
144
|
+
if (typeof errorObj.details === 'string') {
|
|
145
|
+
return errorObj.details;
|
|
146
|
+
}
|
|
147
|
+
// Fallback to JSON representation
|
|
148
|
+
try {
|
|
149
|
+
return JSON.stringify(error, null, 2);
|
|
150
|
+
}
|
|
151
|
+
catch {
|
|
152
|
+
return String(error);
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
return String(error);
|
|
156
|
+
}
|
|
157
|
+
/**
|
|
158
|
+
* Creates a standard success response with formatted text.
|
|
159
|
+
*/
|
|
160
|
+
function successResponse(text) {
|
|
161
|
+
return {
|
|
162
|
+
content: [{
|
|
163
|
+
type: "text",
|
|
164
|
+
text,
|
|
165
|
+
}],
|
|
166
|
+
};
|
|
167
|
+
}
|
|
168
|
+
/**
|
|
169
|
+
* Creates a standard error response with formatted text.
|
|
170
|
+
*/
|
|
171
|
+
function errorResponse(text) {
|
|
172
|
+
return {
|
|
173
|
+
content: [{
|
|
174
|
+
type: "text",
|
|
175
|
+
text: `${text}`,
|
|
176
|
+
}],
|
|
177
|
+
};
|
|
178
|
+
}
|
|
179
|
+
//# sourceMappingURL=tool-helpers.js.map
|
|
@@ -17,6 +17,10 @@ export interface HailerField {
|
|
|
17
17
|
uid?: string;
|
|
18
18
|
description?: string;
|
|
19
19
|
defaultTo?: boolean;
|
|
20
|
+
key?: string;
|
|
21
|
+
subtype?: string;
|
|
22
|
+
placeholder?: string;
|
|
23
|
+
functionVariables?: any;
|
|
20
24
|
}
|
|
21
25
|
export interface HailerPhase {
|
|
22
26
|
_id: string;
|
|
@@ -32,6 +36,8 @@ export interface HailerPhase {
|
|
|
32
36
|
created: number;
|
|
33
37
|
members: any[];
|
|
34
38
|
followers: any[];
|
|
39
|
+
color?: string;
|
|
40
|
+
isInitial?: boolean;
|
|
35
41
|
}
|
|
36
42
|
export interface HailerTranslationField {
|
|
37
43
|
label: string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { HailerV2CoreInitResponse } from "./utils/index";
|
|
1
|
+
import { HailerV2CoreInitResponse, WorkspaceInfo } from "./utils/index";
|
|
2
2
|
import { McpConfig } from "../config";
|
|
3
3
|
export interface UserInfo {
|
|
4
4
|
id: string;
|
|
@@ -6,14 +6,14 @@ export interface UserInfo {
|
|
|
6
6
|
lastname: string;
|
|
7
7
|
fullName: string;
|
|
8
8
|
companies: string[];
|
|
9
|
-
default_profilepic
|
|
9
|
+
default_profilepic?: string;
|
|
10
10
|
lastSeen: number;
|
|
11
11
|
}
|
|
12
12
|
export interface WorkspaceCache {
|
|
13
13
|
users: UserInfo[];
|
|
14
14
|
usersById: Record<string, UserInfo>;
|
|
15
|
-
currentWorkspace:
|
|
16
|
-
allWorkspaces: Record<string,
|
|
15
|
+
currentWorkspace: WorkspaceInfo;
|
|
16
|
+
allWorkspaces: Record<string, WorkspaceInfo>;
|
|
17
17
|
workspaceNames: Record<string, string>;
|
|
18
18
|
timestamp: {
|
|
19
19
|
users: number;
|
|
@@ -34,7 +34,7 @@ export declare function getUserById(cache: WorkspaceCache, userId: string): User
|
|
|
34
34
|
/**
|
|
35
35
|
* Gets workspace by name (case-insensitive)
|
|
36
36
|
*/
|
|
37
|
-
export declare function getWorkspaceByName(cache: WorkspaceCache, name: string):
|
|
37
|
+
export declare function getWorkspaceByName(cache: WorkspaceCache, name: string): WorkspaceInfo | undefined;
|
|
38
38
|
/**
|
|
39
39
|
* Resolves workspace identifier (ID or name) to workspace ID
|
|
40
40
|
*/
|
|
@@ -5,7 +5,8 @@ exports.getUserById = getUserById;
|
|
|
5
5
|
exports.getWorkspaceByName = getWorkspaceByName;
|
|
6
6
|
exports.resolveWorkspaceId = resolveWorkspaceId;
|
|
7
7
|
/**
|
|
8
|
-
* Removes empty/default fields from an object to save context space
|
|
8
|
+
* Removes empty/default fields from an object to save context space.
|
|
9
|
+
* Returns the same type T - empty fields are removed at runtime but type stays intact.
|
|
9
10
|
*/
|
|
10
11
|
function compactObject(obj, config) {
|
|
11
12
|
if (!config.excludeEmptyFields || !obj || typeof obj !== 'object') {
|
|
@@ -49,8 +50,8 @@ function createWorkspaceCache(init, config) {
|
|
|
49
50
|
usersById[user._id] = userInfo;
|
|
50
51
|
});
|
|
51
52
|
// Process workspace data
|
|
52
|
-
const currentWorkspace = init.network || {};
|
|
53
|
-
const allWorkspaces = init.networks || {};
|
|
53
|
+
const currentWorkspace = (init.network || {});
|
|
54
|
+
const allWorkspaces = (init.networks || {});
|
|
54
55
|
const workspaceNames = {};
|
|
55
56
|
// Build workspace name mapping
|
|
56
57
|
Object.values(allWorkspaces).forEach((workspace) => {
|
package/package.json
CHANGED
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
#!/bin/bash
|
|
2
|
-
# Claude Code PreToolUse hook - auto-loads SDK skills before bash commands
|
|
3
|
-
|
|
4
|
-
TOOL="$1"
|
|
5
|
-
|
|
6
|
-
# Only process Bash tool
|
|
7
|
-
if [[ "$TOOL" != "Bash" ]]; then
|
|
8
|
-
exit 0
|
|
9
|
-
fi
|
|
10
|
-
|
|
11
|
-
# Read tool input from stdin
|
|
12
|
-
INPUT=$(cat)
|
|
13
|
-
COMMAND=$(echo "$INPUT" | jq -r '.command // empty')
|
|
14
|
-
|
|
15
|
-
# Marker directory for tracking loaded skills this session
|
|
16
|
-
MARKER_DIR="/tmp/.claude-skills-loaded"
|
|
17
|
-
mkdir -p "$MARKER_DIR"
|
|
18
|
-
|
|
19
|
-
# SDK command to skill mapping
|
|
20
|
-
load_skill_if_needed() {
|
|
21
|
-
local skill_name="$1"
|
|
22
|
-
local marker_file="$MARKER_DIR/$skill_name"
|
|
23
|
-
local skill_path=".claude/skills/$skill_name/SKILL.md"
|
|
24
|
-
|
|
25
|
-
if [[ ! -f "$marker_file" ]] && [[ -f "$skill_path" ]]; then
|
|
26
|
-
echo "" >&2
|
|
27
|
-
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━" >&2
|
|
28
|
-
echo "📚 AUTO-LOADING SKILL: $skill_name" >&2
|
|
29
|
-
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━" >&2
|
|
30
|
-
echo "" >&2
|
|
31
|
-
cat "$skill_path" >&2
|
|
32
|
-
echo "" >&2
|
|
33
|
-
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━" >&2
|
|
34
|
-
echo "" >&2
|
|
35
|
-
touch "$marker_file"
|
|
36
|
-
fi
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
# Check for SDK commands and load appropriate skills
|
|
40
|
-
case "$COMMAND" in
|
|
41
|
-
*"npm run pull"*|*"npm run push"*|*"npm run workflows"*|*"npm run phases"*|*"npm run fields"*|*"npm run groups"*|*"npm run teams"*|*"npm run insights"*)
|
|
42
|
-
load_skill_if_needed "SDK-ws-config-skill"
|
|
43
|
-
;;
|
|
44
|
-
*"npm run generate"*|*"hailer-sdk generate"*)
|
|
45
|
-
load_skill_if_needed "SDK-generate-skill"
|
|
46
|
-
;;
|
|
47
|
-
*"hailer-sdk init"*)
|
|
48
|
-
load_skill_if_needed "SDK-init-skill"
|
|
49
|
-
;;
|
|
50
|
-
esac
|
|
51
|
-
|
|
52
|
-
exit 0
|