@shin1ohno/sage 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/LICENSE +21 -0
- package/README.md +168 -0
- package/dist/config/loader.d.ts +37 -0
- package/dist/config/loader.d.ts.map +1 -0
- package/dist/config/loader.js +95 -0
- package/dist/config/loader.js.map +1 -0
- package/dist/config/storage/file-storage.d.ts +35 -0
- package/dist/config/storage/file-storage.d.ts.map +1 -0
- package/dist/config/storage/file-storage.js +76 -0
- package/dist/config/storage/file-storage.js.map +1 -0
- package/dist/config/storage/index.d.ts +8 -0
- package/dist/config/storage/index.d.ts.map +1 -0
- package/dist/config/storage/index.js +8 -0
- package/dist/config/storage/index.js.map +1 -0
- package/dist/config/storage/session-storage.d.ts +35 -0
- package/dist/config/storage/session-storage.d.ts.map +1 -0
- package/dist/config/storage/session-storage.js +44 -0
- package/dist/config/storage/session-storage.js.map +1 -0
- package/dist/config/storage/storage-factory.d.ts +32 -0
- package/dist/config/storage/storage-factory.d.ts.map +1 -0
- package/dist/config/storage/storage-factory.js +78 -0
- package/dist/config/storage/storage-factory.js.map +1 -0
- package/dist/core/index.d.ts +6 -0
- package/dist/core/index.d.ts.map +1 -0
- package/dist/core/index.js +6 -0
- package/dist/core/index.js.map +1 -0
- package/dist/core/sage-core.d.ts +80 -0
- package/dist/core/sage-core.d.ts.map +1 -0
- package/dist/core/sage-core.js +190 -0
- package/dist/core/sage-core.js.map +1 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +901 -0
- package/dist/index.js.map +1 -0
- package/dist/integrations/apple-reminders.d.ts +96 -0
- package/dist/integrations/apple-reminders.d.ts.map +1 -0
- package/dist/integrations/apple-reminders.js +250 -0
- package/dist/integrations/apple-reminders.js.map +1 -0
- package/dist/integrations/calendar-service.d.ts +126 -0
- package/dist/integrations/calendar-service.d.ts.map +1 -0
- package/dist/integrations/calendar-service.js +295 -0
- package/dist/integrations/calendar-service.js.map +1 -0
- package/dist/integrations/notion-mcp.d.ts +121 -0
- package/dist/integrations/notion-mcp.d.ts.map +1 -0
- package/dist/integrations/notion-mcp.js +281 -0
- package/dist/integrations/notion-mcp.js.map +1 -0
- package/dist/integrations/reminder-manager.d.ts +90 -0
- package/dist/integrations/reminder-manager.d.ts.map +1 -0
- package/dist/integrations/reminder-manager.js +182 -0
- package/dist/integrations/reminder-manager.js.map +1 -0
- package/dist/platform/adapter-factory.d.ts +22 -0
- package/dist/platform/adapter-factory.d.ts.map +1 -0
- package/dist/platform/adapter-factory.js +41 -0
- package/dist/platform/adapter-factory.js.map +1 -0
- package/dist/platform/adapters/mcp-adapter.d.ts +32 -0
- package/dist/platform/adapters/mcp-adapter.d.ts.map +1 -0
- package/dist/platform/adapters/mcp-adapter.js +52 -0
- package/dist/platform/adapters/mcp-adapter.js.map +1 -0
- package/dist/platform/adapters/skills-adapter-ios.d.ts +38 -0
- package/dist/platform/adapters/skills-adapter-ios.d.ts.map +1 -0
- package/dist/platform/adapters/skills-adapter-ios.js +59 -0
- package/dist/platform/adapters/skills-adapter-ios.js.map +1 -0
- package/dist/platform/adapters/skills-adapter-web.d.ts +36 -0
- package/dist/platform/adapters/skills-adapter-web.d.ts.map +1 -0
- package/dist/platform/adapters/skills-adapter-web.js +56 -0
- package/dist/platform/adapters/skills-adapter-web.js.map +1 -0
- package/dist/platform/detector.d.ts +60 -0
- package/dist/platform/detector.d.ts.map +1 -0
- package/dist/platform/detector.js +217 -0
- package/dist/platform/detector.js.map +1 -0
- package/dist/platform/index.d.ts +11 -0
- package/dist/platform/index.d.ts.map +1 -0
- package/dist/platform/index.js +11 -0
- package/dist/platform/index.js.map +1 -0
- package/dist/platform/types.d.ts +205 -0
- package/dist/platform/types.d.ts.map +1 -0
- package/dist/platform/types.js +33 -0
- package/dist/platform/types.js.map +1 -0
- package/dist/setup/questions.d.ts +15 -0
- package/dist/setup/questions.d.ts.map +1 -0
- package/dist/setup/questions.js +131 -0
- package/dist/setup/questions.js.map +1 -0
- package/dist/setup/wizard.d.ts +51 -0
- package/dist/setup/wizard.d.ts.map +1 -0
- package/dist/setup/wizard.js +210 -0
- package/dist/setup/wizard.js.map +1 -0
- package/dist/tools/analyze-tasks.d.ts +61 -0
- package/dist/tools/analyze-tasks.d.ts.map +1 -0
- package/dist/tools/analyze-tasks.js +258 -0
- package/dist/tools/analyze-tasks.js.map +1 -0
- package/dist/types/config.d.ts +126 -0
- package/dist/types/config.d.ts.map +1 -0
- package/dist/types/config.js +118 -0
- package/dist/types/config.js.map +1 -0
- package/dist/types/errors.d.ts +39 -0
- package/dist/types/errors.d.ts.map +1 -0
- package/dist/types/errors.js +83 -0
- package/dist/types/errors.js.map +1 -0
- package/dist/types/index.d.ts +7 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +7 -0
- package/dist/types/index.js.map +1 -0
- package/dist/types/task.d.ts +69 -0
- package/dist/types/task.d.ts.map +1 -0
- package/dist/types/task.js +5 -0
- package/dist/types/task.js.map +1 -0
- package/dist/utils/estimation.d.ts +49 -0
- package/dist/utils/estimation.d.ts.map +1 -0
- package/dist/utils/estimation.js +244 -0
- package/dist/utils/estimation.js.map +1 -0
- package/dist/utils/priority.d.ts +68 -0
- package/dist/utils/priority.d.ts.map +1 -0
- package/dist/utils/priority.js +243 -0
- package/dist/utils/priority.js.map +1 -0
- package/dist/utils/retry.d.ts +62 -0
- package/dist/utils/retry.d.ts.map +1 -0
- package/dist/utils/retry.js +161 -0
- package/dist/utils/retry.js.map +1 -0
- package/dist/utils/stakeholders.d.ts +61 -0
- package/dist/utils/stakeholders.d.ts.map +1 -0
- package/dist/utils/stakeholders.js +301 -0
- package/dist/utils/stakeholders.js.map +1 -0
- package/dist/utils/task-splitter.d.ts +45 -0
- package/dist/utils/task-splitter.d.ts.map +1 -0
- package/dist/utils/task-splitter.js +321 -0
- package/dist/utils/task-splitter.js.map +1 -0
- package/package.json +66 -0
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Platform Types
|
|
3
|
+
* Defines types for multi-platform support
|
|
4
|
+
* Requirements: 7.1, 7.2, 7.3
|
|
5
|
+
*
|
|
6
|
+
* 現行実装: desktop_mcp(Claude Desktop/Code)
|
|
7
|
+
* 将来対応予定: ios_skills, ipados_skills, web_skills
|
|
8
|
+
* (Claude Skills APIがデバイスAPIへのアクセスを提供した時点で実装)
|
|
9
|
+
*/
|
|
10
|
+
/**
|
|
11
|
+
* Platform type enumeration
|
|
12
|
+
*/
|
|
13
|
+
export type PlatformType = 'desktop_mcp' | 'ios_skills' | 'ipados_skills' | 'web_skills';
|
|
14
|
+
/**
|
|
15
|
+
* Platform information
|
|
16
|
+
*/
|
|
17
|
+
export interface PlatformInfo {
|
|
18
|
+
type: PlatformType;
|
|
19
|
+
version: string;
|
|
20
|
+
capabilities: PlatformCapability[];
|
|
21
|
+
nativeIntegrations: string[];
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Platform capability definition
|
|
25
|
+
*/
|
|
26
|
+
export interface PlatformCapability {
|
|
27
|
+
name: string;
|
|
28
|
+
available: boolean;
|
|
29
|
+
requiresPermission: boolean;
|
|
30
|
+
fallbackAvailable: boolean;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Feature set available on a platform
|
|
34
|
+
*/
|
|
35
|
+
export interface FeatureSet {
|
|
36
|
+
taskAnalysis: boolean;
|
|
37
|
+
persistentConfig: boolean;
|
|
38
|
+
appleReminders: boolean;
|
|
39
|
+
calendarIntegration: boolean;
|
|
40
|
+
notionIntegration: boolean;
|
|
41
|
+
fileSystemAccess: boolean;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Permission status for native integrations
|
|
45
|
+
*/
|
|
46
|
+
export interface PermissionStatus {
|
|
47
|
+
reminders: 'granted' | 'denied' | 'not_determined';
|
|
48
|
+
calendar: 'granted' | 'denied' | 'not_determined';
|
|
49
|
+
notion: 'granted' | 'denied' | 'not_determined';
|
|
50
|
+
canRequestPermission: boolean;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Platform-specific configuration
|
|
54
|
+
*/
|
|
55
|
+
export interface PlatformSpecificConfig {
|
|
56
|
+
type: PlatformType;
|
|
57
|
+
nativeIntegrationsEnabled: boolean;
|
|
58
|
+
fallbackMethods: string[];
|
|
59
|
+
permissionsGranted: Record<string, boolean>;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Platform adapter interface
|
|
63
|
+
* All platform-specific implementations must implement this interface
|
|
64
|
+
*/
|
|
65
|
+
export interface PlatformAdapter {
|
|
66
|
+
/**
|
|
67
|
+
* Get platform information
|
|
68
|
+
*/
|
|
69
|
+
getPlatformInfo(): PlatformInfo;
|
|
70
|
+
/**
|
|
71
|
+
* Get available features on this platform
|
|
72
|
+
*/
|
|
73
|
+
getAvailableFeatures(): FeatureSet;
|
|
74
|
+
/**
|
|
75
|
+
* Initialize the adapter
|
|
76
|
+
*/
|
|
77
|
+
initialize(): Promise<void>;
|
|
78
|
+
/**
|
|
79
|
+
* Check if a specific capability is available
|
|
80
|
+
*/
|
|
81
|
+
isCapabilityAvailable(capability: string): boolean;
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Configuration storage interface
|
|
85
|
+
* Different platforms use different storage mechanisms
|
|
86
|
+
*/
|
|
87
|
+
export interface ConfigStorage {
|
|
88
|
+
/**
|
|
89
|
+
* Load configuration from storage
|
|
90
|
+
*/
|
|
91
|
+
load(): Promise<Record<string, unknown> | null>;
|
|
92
|
+
/**
|
|
93
|
+
* Save configuration to storage
|
|
94
|
+
*/
|
|
95
|
+
save(config: Record<string, unknown>): Promise<void>;
|
|
96
|
+
/**
|
|
97
|
+
* Check if configuration exists
|
|
98
|
+
*/
|
|
99
|
+
exists(): Promise<boolean>;
|
|
100
|
+
/**
|
|
101
|
+
* Delete configuration
|
|
102
|
+
*/
|
|
103
|
+
delete(): Promise<void>;
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* Native integration service interface
|
|
107
|
+
* Used for iOS/iPadOS native integrations
|
|
108
|
+
*/
|
|
109
|
+
export interface NativeIntegrationService {
|
|
110
|
+
/**
|
|
111
|
+
* Create a reminder using native API
|
|
112
|
+
*/
|
|
113
|
+
createReminder(request: NativeReminderRequest): Promise<NativeReminderResult>;
|
|
114
|
+
/**
|
|
115
|
+
* Fetch calendar events using native API
|
|
116
|
+
*/
|
|
117
|
+
fetchCalendarEvents(startDate: string, endDate: string): Promise<NativeCalendarEvent[]>;
|
|
118
|
+
/**
|
|
119
|
+
* Create a Notion page using Connector API
|
|
120
|
+
*/
|
|
121
|
+
createNotionPage(request: NativeNotionRequest): Promise<NativeNotionResult>;
|
|
122
|
+
/**
|
|
123
|
+
* Check permission status
|
|
124
|
+
*/
|
|
125
|
+
checkPermissions(): Promise<PermissionStatus>;
|
|
126
|
+
/**
|
|
127
|
+
* Request permissions from user
|
|
128
|
+
*/
|
|
129
|
+
requestPermissions(): Promise<PermissionStatus>;
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* Native reminder request
|
|
133
|
+
*/
|
|
134
|
+
export interface NativeReminderRequest {
|
|
135
|
+
title: string;
|
|
136
|
+
notes?: string;
|
|
137
|
+
dueDate?: string;
|
|
138
|
+
list?: string;
|
|
139
|
+
priority?: 'low' | 'medium' | 'high';
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* Native reminder result
|
|
143
|
+
*/
|
|
144
|
+
export interface NativeReminderResult {
|
|
145
|
+
success: boolean;
|
|
146
|
+
method: 'native' | 'applescript' | 'fallback';
|
|
147
|
+
reminderId?: string;
|
|
148
|
+
reminderUrl?: string;
|
|
149
|
+
error?: string;
|
|
150
|
+
}
|
|
151
|
+
/**
|
|
152
|
+
* Native calendar event
|
|
153
|
+
*/
|
|
154
|
+
export interface NativeCalendarEvent {
|
|
155
|
+
id: string;
|
|
156
|
+
title: string;
|
|
157
|
+
start: string;
|
|
158
|
+
end: string;
|
|
159
|
+
isAllDay: boolean;
|
|
160
|
+
source: string;
|
|
161
|
+
}
|
|
162
|
+
/**
|
|
163
|
+
* Native Notion page request
|
|
164
|
+
*/
|
|
165
|
+
export interface NativeNotionRequest {
|
|
166
|
+
databaseId: string;
|
|
167
|
+
title: string;
|
|
168
|
+
properties?: Record<string, unknown>;
|
|
169
|
+
content?: string;
|
|
170
|
+
}
|
|
171
|
+
/**
|
|
172
|
+
* Native Notion page result
|
|
173
|
+
*/
|
|
174
|
+
export interface NativeNotionResult {
|
|
175
|
+
success: boolean;
|
|
176
|
+
method: 'connector' | 'mcp' | 'fallback';
|
|
177
|
+
pageId?: string;
|
|
178
|
+
pageUrl?: string;
|
|
179
|
+
error?: string;
|
|
180
|
+
fallbackText?: string;
|
|
181
|
+
}
|
|
182
|
+
/**
|
|
183
|
+
* Capability names
|
|
184
|
+
*/
|
|
185
|
+
export declare const CAPABILITY_NAMES: {
|
|
186
|
+
readonly FILE_SYSTEM: "file_system";
|
|
187
|
+
readonly EXTERNAL_PROCESS: "external_process";
|
|
188
|
+
readonly MCP_INTEGRATION: "mcp_integration";
|
|
189
|
+
readonly SESSION_STORAGE: "session_storage";
|
|
190
|
+
readonly ICLOUD_SYNC: "icloud_sync";
|
|
191
|
+
readonly NATIVE_REMINDERS: "native_reminders";
|
|
192
|
+
readonly NATIVE_CALENDAR: "native_calendar";
|
|
193
|
+
readonly NOTION_CONNECTOR: "notion_connector";
|
|
194
|
+
};
|
|
195
|
+
/**
|
|
196
|
+
* Integration names
|
|
197
|
+
*/
|
|
198
|
+
export declare const INTEGRATION_NAMES: {
|
|
199
|
+
readonly APPLESCRIPT: "applescript";
|
|
200
|
+
readonly NOTION_MCP: "notion_mcp";
|
|
201
|
+
readonly NOTION_CONNECTOR: "notion_connector";
|
|
202
|
+
readonly REMINDERS: "reminders";
|
|
203
|
+
readonly CALENDAR: "calendar";
|
|
204
|
+
};
|
|
205
|
+
//# sourceMappingURL=types.d.ts.map
|
|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
|
|
|
1
|
+
/**
|
|
2
|
+
* Platform Types
|
|
3
|
+
* Defines types for multi-platform support
|
|
4
|
+
* Requirements: 7.1, 7.2, 7.3
|
|
5
|
+
*
|
|
6
|
+
* 現行実装: desktop_mcp(Claude Desktop/Code)
|
|
7
|
+
* 将来対応予定: ios_skills, ipados_skills, web_skills
|
|
8
|
+
* (Claude Skills APIがデバイスAPIへのアクセスを提供した時点で実装)
|
|
9
|
+
*/
|
|
10
|
+
/**
|
|
11
|
+
* Capability names
|
|
12
|
+
*/
|
|
13
|
+
export const CAPABILITY_NAMES = {
|
|
14
|
+
FILE_SYSTEM: 'file_system',
|
|
15
|
+
EXTERNAL_PROCESS: 'external_process',
|
|
16
|
+
MCP_INTEGRATION: 'mcp_integration',
|
|
17
|
+
SESSION_STORAGE: 'session_storage',
|
|
18
|
+
ICLOUD_SYNC: 'icloud_sync',
|
|
19
|
+
NATIVE_REMINDERS: 'native_reminders',
|
|
20
|
+
NATIVE_CALENDAR: 'native_calendar',
|
|
21
|
+
NOTION_CONNECTOR: 'notion_connector',
|
|
22
|
+
};
|
|
23
|
+
/**
|
|
24
|
+
* Integration names
|
|
25
|
+
*/
|
|
26
|
+
export const INTEGRATION_NAMES = {
|
|
27
|
+
APPLESCRIPT: 'applescript',
|
|
28
|
+
NOTION_MCP: 'notion_mcp',
|
|
29
|
+
NOTION_CONNECTOR: 'notion_connector',
|
|
30
|
+
REMINDERS: 'reminders',
|
|
31
|
+
CALENDAR: 'calendar',
|
|
32
|
+
};
|
|
33
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/platform/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAsMH;;GAEG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG;IAC9B,WAAW,EAAE,aAAa;IAC1B,gBAAgB,EAAE,kBAAkB;IACpC,eAAe,EAAE,iBAAiB;IAClC,eAAe,EAAE,iBAAiB;IAClC,WAAW,EAAE,aAAa;IAC1B,gBAAgB,EAAE,kBAAkB;IACpC,eAAe,EAAE,iBAAiB;IAClC,gBAAgB,EAAE,kBAAkB;CAC5B,CAAC;AAEX;;GAEG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG;IAC/B,WAAW,EAAE,aAAa;IAC1B,UAAU,EAAE,YAAY;IACxB,gBAAgB,EAAE,kBAAkB;IACpC,SAAS,EAAE,WAAW;IACtB,QAAQ,EAAE,UAAU;CACZ,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Setup Wizard Questions
|
|
3
|
+
* Defines the questions asked during initial setup
|
|
4
|
+
*/
|
|
5
|
+
export interface Question {
|
|
6
|
+
id: string;
|
|
7
|
+
text: string;
|
|
8
|
+
type: 'text' | 'select' | 'multiselect' | 'time' | 'days';
|
|
9
|
+
options?: string[];
|
|
10
|
+
defaultValue?: string | string[];
|
|
11
|
+
helpText?: string;
|
|
12
|
+
essential: boolean;
|
|
13
|
+
}
|
|
14
|
+
export declare const WIZARD_QUESTIONS: Question[];
|
|
15
|
+
//# sourceMappingURL=questions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"questions.d.ts","sourceRoot":"","sources":["../../src/setup/questions.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,MAAM,WAAW,QAAQ;IACvB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,GAAG,QAAQ,GAAG,aAAa,GAAG,MAAM,GAAG,MAAM,CAAC;IAC1D,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,YAAY,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IACjC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,OAAO,CAAC;CACpB;AAED,eAAO,MAAM,gBAAgB,EAAE,QAAQ,EA8HtC,CAAC"}
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Setup Wizard Questions
|
|
3
|
+
* Defines the questions asked during initial setup
|
|
4
|
+
*/
|
|
5
|
+
export const WIZARD_QUESTIONS = [
|
|
6
|
+
// Essential questions (used in quick mode)
|
|
7
|
+
{
|
|
8
|
+
id: 'user_name',
|
|
9
|
+
text: 'お名前を教えてください',
|
|
10
|
+
type: 'text',
|
|
11
|
+
helpText: 'sageがあなたを呼ぶ際に使用します',
|
|
12
|
+
essential: true,
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
id: 'timezone',
|
|
16
|
+
text: 'タイムゾーンを選択してください',
|
|
17
|
+
type: 'select',
|
|
18
|
+
options: ['Asia/Tokyo', 'America/New_York', 'America/Los_Angeles', 'Europe/London', 'UTC'],
|
|
19
|
+
defaultValue: 'Asia/Tokyo',
|
|
20
|
+
helpText: 'スケジュールとリマインドの時刻に使用されます',
|
|
21
|
+
essential: true,
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
id: 'work_start',
|
|
25
|
+
text: '勤務開始時刻を教えてください(HH:MM形式)',
|
|
26
|
+
type: 'time',
|
|
27
|
+
defaultValue: '09:00',
|
|
28
|
+
helpText: '空き時間の検索に使用されます',
|
|
29
|
+
essential: true,
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
id: 'work_end',
|
|
33
|
+
text: '勤務終了時刻を教えてください(HH:MM形式)',
|
|
34
|
+
type: 'time',
|
|
35
|
+
defaultValue: '18:00',
|
|
36
|
+
helpText: '空き時間の検索に使用されます',
|
|
37
|
+
essential: true,
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
id: 'apple_reminders_enabled',
|
|
41
|
+
text: 'Apple Remindersを使用しますか?',
|
|
42
|
+
type: 'select',
|
|
43
|
+
options: ['yes', 'no'],
|
|
44
|
+
defaultValue: 'yes',
|
|
45
|
+
helpText: '7日以内の短期タスクのリマインドに使用されます',
|
|
46
|
+
essential: true,
|
|
47
|
+
},
|
|
48
|
+
// Additional questions (used in full mode)
|
|
49
|
+
{
|
|
50
|
+
id: 'user_email',
|
|
51
|
+
text: 'メールアドレスを教えてください(任意)',
|
|
52
|
+
type: 'text',
|
|
53
|
+
helpText: 'カレンダー統合に使用される場合があります',
|
|
54
|
+
essential: false,
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
id: 'user_role',
|
|
58
|
+
text: 'あなたの役職を教えてください(任意)',
|
|
59
|
+
type: 'text',
|
|
60
|
+
helpText: 'タスク分析のパーソナライズに使用されます',
|
|
61
|
+
essential: false,
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
id: 'manager_name',
|
|
65
|
+
text: 'マネージャーの名前を教えてください(任意)',
|
|
66
|
+
type: 'text',
|
|
67
|
+
helpText: 'マネージャーからのタスクの優先度を高く設定します',
|
|
68
|
+
essential: false,
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
id: 'meeting_days',
|
|
72
|
+
text: '会議が多い曜日を選択してください',
|
|
73
|
+
type: 'days',
|
|
74
|
+
options: ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday'],
|
|
75
|
+
defaultValue: ['Tuesday', 'Thursday'],
|
|
76
|
+
helpText: 'これらの日は深い作業よりも会議に適していると判断されます',
|
|
77
|
+
essential: false,
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
id: 'deep_work_days',
|
|
81
|
+
text: '集中作業(ディープワーク)に適した曜日を選択してください',
|
|
82
|
+
type: 'days',
|
|
83
|
+
options: ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday'],
|
|
84
|
+
defaultValue: ['Monday', 'Wednesday', 'Friday'],
|
|
85
|
+
helpText: 'これらの日は複雑なタスクのスケジュールに優先されます',
|
|
86
|
+
essential: false,
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
id: 'apple_reminders_list',
|
|
90
|
+
text: 'Apple Remindersで使用するリスト名を教えてください',
|
|
91
|
+
type: 'text',
|
|
92
|
+
defaultValue: 'Reminders',
|
|
93
|
+
helpText: 'リマインダーが作成されるリストの名前',
|
|
94
|
+
essential: false,
|
|
95
|
+
},
|
|
96
|
+
{
|
|
97
|
+
id: 'notion_enabled',
|
|
98
|
+
text: 'Notionを使用しますか?',
|
|
99
|
+
type: 'select',
|
|
100
|
+
options: ['yes', 'no'],
|
|
101
|
+
defaultValue: 'no',
|
|
102
|
+
helpText: '8日以上先の長期タスクの管理に使用されます',
|
|
103
|
+
essential: false,
|
|
104
|
+
},
|
|
105
|
+
{
|
|
106
|
+
id: 'notion_database_id',
|
|
107
|
+
text: 'NotionデータベースIDを教えてください(任意)',
|
|
108
|
+
type: 'text',
|
|
109
|
+
helpText: 'Notion統合を使用する場合に必要です',
|
|
110
|
+
essential: false,
|
|
111
|
+
},
|
|
112
|
+
{
|
|
113
|
+
id: 'google_calendar_enabled',
|
|
114
|
+
text: 'Google Calendarを使用しますか?',
|
|
115
|
+
type: 'select',
|
|
116
|
+
options: ['yes', 'no'],
|
|
117
|
+
defaultValue: 'no',
|
|
118
|
+
helpText: 'カレンダーから空き時間を検出するために使用されます',
|
|
119
|
+
essential: false,
|
|
120
|
+
},
|
|
121
|
+
{
|
|
122
|
+
id: 'language',
|
|
123
|
+
text: '使用する言語を選択してください',
|
|
124
|
+
type: 'select',
|
|
125
|
+
options: ['ja', 'en'],
|
|
126
|
+
defaultValue: 'ja',
|
|
127
|
+
helpText: 'メッセージやレスポンスの言語',
|
|
128
|
+
essential: false,
|
|
129
|
+
},
|
|
130
|
+
];
|
|
131
|
+
//# sourceMappingURL=questions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"questions.js","sourceRoot":"","sources":["../../src/setup/questions.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAYH,MAAM,CAAC,MAAM,gBAAgB,GAAe;IAC1C,2CAA2C;IAC3C;QACE,EAAE,EAAE,WAAW;QACf,IAAI,EAAE,aAAa;QACnB,IA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AC,KAAK,EAAE,IAAI,CAAC;QACtB,YAAY,EAAE,IAAI;QAClB,QAAQ,EAAE,2BAA2B;QACrC,SAAS,EAAE,KAAK;KACjB;IACD;QACE,EAAE,EAAE,UAAU;QACd,IAAI,EAAE,iBAAiB;QACvB,IAAI,EAAE,QAAQ;QACd,OAAO,EAAE,CAAC,IAAI,EAAE,IAAI,CAAC;QACrB,YAAY,EAAE,IAAI;QAClB,QAAQ,EAAE,gBAAgB;QAC1B,SAAS,EAAE,KAAK;KACjB;CACF,CAAC"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Setup Wizard
|
|
3
|
+
* Interactive wizard for initial sage configuration
|
|
4
|
+
*/
|
|
5
|
+
import type { UserConfig } from '../types/index.js';
|
|
6
|
+
import { type Question } from './questions.js';
|
|
7
|
+
export interface WizardSession {
|
|
8
|
+
sessionId: string;
|
|
9
|
+
mode: 'full' | 'quick';
|
|
10
|
+
currentStep: number;
|
|
11
|
+
totalSteps: number;
|
|
12
|
+
answers: Record<string, string | string[]>;
|
|
13
|
+
startedAt: string;
|
|
14
|
+
}
|
|
15
|
+
interface AnswerResult {
|
|
16
|
+
success: boolean;
|
|
17
|
+
error?: string;
|
|
18
|
+
isComplete?: boolean;
|
|
19
|
+
currentQuestion?: Question;
|
|
20
|
+
}
|
|
21
|
+
export declare class SetupWizard {
|
|
22
|
+
/**
|
|
23
|
+
* Create a new wizard session
|
|
24
|
+
*/
|
|
25
|
+
static createSession(mode?: 'full' | 'quick'): WizardSession;
|
|
26
|
+
/**
|
|
27
|
+
* Get questions based on mode
|
|
28
|
+
*/
|
|
29
|
+
static getQuestionsForMode(mode: 'full' | 'quick'): Question[];
|
|
30
|
+
/**
|
|
31
|
+
* Get the current question for a session
|
|
32
|
+
*/
|
|
33
|
+
static getCurrentQuestion(session: WizardSession): Question;
|
|
34
|
+
/**
|
|
35
|
+
* Answer a question and advance to the next
|
|
36
|
+
*/
|
|
37
|
+
static answerQuestion(session: WizardSession, questionId: string, answer: string | string[]): AnswerResult;
|
|
38
|
+
/**
|
|
39
|
+
* Validate an answer against a question
|
|
40
|
+
*/
|
|
41
|
+
static validateAnswer(question: Question, answer: string | string[]): {
|
|
42
|
+
valid: boolean;
|
|
43
|
+
error?: string;
|
|
44
|
+
};
|
|
45
|
+
/**
|
|
46
|
+
* Build a UserConfig from wizard answers
|
|
47
|
+
*/
|
|
48
|
+
static buildConfig(session: WizardSession): UserConfig;
|
|
49
|
+
}
|
|
50
|
+
export {};
|
|
51
|
+
//# sourceMappingURL=wizard.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wizard.d.ts","sourceRoot":"","sources":["../../src/setup/wizard.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAEpD,OAAO,EAAoB,KAAK,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAEjE,MAAM,WAAW,aAAa;IAC5B,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC;IACvB,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC,CAAC;IAC3C,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,UAAU,YAAY;IACpB,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,eAAe,CAAC,EAAE,QAAQ,CAAC;CAC5B;AAED,qBAAa,WAAW;IACtB;;OAEG;IACH,MAAM,CAAC,aAAa,CAAC,IAAI,GAAE,MAAM,GAAG,OAAgB,GAAG,aAAa;IAapE;;OAEG;IACH,MAAM,CAAC,mBAAmB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,GAAG,QAAQ,EAAE;IAO9D;;OAEG;IACH,MAAM,CAAC,kBAAkB,CAAC,OAAO,EAAE,aAAa,GAAG,QAAQ;IAK3D;;OAEG;IACH,MAAM,CAAC,cAAc,CACnB,OAAO,EAAE,aAAa,EACtB,UAAU,EAAE,MAAM,EAClB,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,GACxB,YAAY;IAyCf;;OAEG;IACH,MAAM,CAAC,cAAc,CACnB,QAAQ,EAAE,QAAQ,EAClB,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,GACxB;QAAE,KAAK,EAAE,OAAO,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAA;KAAE;IAkErC;;OAEG;IACH,MAAM,CAAC,WAAW,CAAC,OAAO,EAAE,aAAa,GAAG,UAAU;CAqEvD"}
|
|
@@ -0,0 +1,210 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Setup Wizard
|
|
3
|
+
* Interactive wizard for initial sage configuration
|
|
4
|
+
*/
|
|
5
|
+
import { DEFAULT_CONFIG } from '../types/config.js';
|
|
6
|
+
import { WIZARD_QUESTIONS } from './questions.js';
|
|
7
|
+
export class SetupWizard {
|
|
8
|
+
/**
|
|
9
|
+
* Create a new wizard session
|
|
10
|
+
*/
|
|
11
|
+
static createSession(mode = 'full') {
|
|
12
|
+
const questions = this.getQuestionsForMode(mode);
|
|
13
|
+
return {
|
|
14
|
+
sessionId: `session_${Date.now()}_${Math.random().toString(36).substring(2, 9)}`,
|
|
15
|
+
mode,
|
|
16
|
+
currentStep: 1,
|
|
17
|
+
totalSteps: questions.length,
|
|
18
|
+
answers: {},
|
|
19
|
+
startedAt: new Date().toISOString(),
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Get questions based on mode
|
|
24
|
+
*/
|
|
25
|
+
static getQuestionsForMode(mode) {
|
|
26
|
+
if (mode === 'quick') {
|
|
27
|
+
return WIZARD_QUESTIONS.filter((q) => q.essential);
|
|
28
|
+
}
|
|
29
|
+
return WIZARD_QUESTIONS;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Get the current question for a session
|
|
33
|
+
*/
|
|
34
|
+
static getCurrentQuestion(session) {
|
|
35
|
+
const questions = this.getQuestionsForMode(session.mode);
|
|
36
|
+
return questions[session.currentStep - 1];
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Answer a question and advance to the next
|
|
40
|
+
*/
|
|
41
|
+
static answerQuestion(session, questionId, answer) {
|
|
42
|
+
const currentQuestion = this.getCurrentQuestion(session);
|
|
43
|
+
// Validate question ID matches
|
|
44
|
+
if (currentQuestion.id !== questionId) {
|
|
45
|
+
return {
|
|
46
|
+
success: false,
|
|
47
|
+
error: `質問IDが一致しません。期待: ${currentQuestion.id}, 受信: ${questionId}`,
|
|
48
|
+
currentQuestion,
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
// Validate answer
|
|
52
|
+
const validationResult = this.validateAnswer(currentQuestion, answer);
|
|
53
|
+
if (!validationResult.valid) {
|
|
54
|
+
return {
|
|
55
|
+
success: false,
|
|
56
|
+
error: validationResult.error,
|
|
57
|
+
currentQuestion,
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
// Store answer
|
|
61
|
+
session.answers[questionId] = answer;
|
|
62
|
+
session.currentStep++;
|
|
63
|
+
// Check if complete
|
|
64
|
+
const questions = this.getQuestionsForMode(session.mode);
|
|
65
|
+
if (session.currentStep > questions.length) {
|
|
66
|
+
return {
|
|
67
|
+
success: true,
|
|
68
|
+
isComplete: true,
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
return {
|
|
72
|
+
success: true,
|
|
73
|
+
isComplete: false,
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Validate an answer against a question
|
|
78
|
+
*/
|
|
79
|
+
static validateAnswer(question, answer) {
|
|
80
|
+
// Check if answer is provided
|
|
81
|
+
if (answer === undefined || answer === null || answer === '') {
|
|
82
|
+
if (question.defaultValue !== undefined) {
|
|
83
|
+
return { valid: true };
|
|
84
|
+
}
|
|
85
|
+
return { valid: false, error: 'この質問には回答が必要です。' };
|
|
86
|
+
}
|
|
87
|
+
// Validate based on question type
|
|
88
|
+
switch (question.type) {
|
|
89
|
+
case 'select':
|
|
90
|
+
if (question.options && !question.options.includes(answer)) {
|
|
91
|
+
return {
|
|
92
|
+
valid: false,
|
|
93
|
+
error: `無効な選択肢です。有効な選択肢: ${question.options.join(', ')}`,
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
break;
|
|
97
|
+
case 'multiselect':
|
|
98
|
+
if (Array.isArray(answer)) {
|
|
99
|
+
const invalid = answer.filter((a) => !question.options?.includes(a));
|
|
100
|
+
if (invalid.length > 0) {
|
|
101
|
+
return {
|
|
102
|
+
valid: false,
|
|
103
|
+
error: `無効な選択肢が含まれています: ${invalid.join(', ')}`,
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
break;
|
|
108
|
+
case 'time':
|
|
109
|
+
if (!/^\d{2}:\d{2}$/.test(answer)) {
|
|
110
|
+
return {
|
|
111
|
+
valid: false,
|
|
112
|
+
error: '時刻はHH:MM形式で入力してください(例: 09:00)',
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
break;
|
|
116
|
+
case 'days':
|
|
117
|
+
const validDays = [
|
|
118
|
+
'Monday',
|
|
119
|
+
'Tuesday',
|
|
120
|
+
'Wednesday',
|
|
121
|
+
'Thursday',
|
|
122
|
+
'Friday',
|
|
123
|
+
'Saturday',
|
|
124
|
+
'Sunday',
|
|
125
|
+
];
|
|
126
|
+
if (Array.isArray(answer)) {
|
|
127
|
+
const invalid = answer.filter((a) => !validDays.includes(a));
|
|
128
|
+
if (invalid.length > 0) {
|
|
129
|
+
return {
|
|
130
|
+
valid: false,
|
|
131
|
+
error: `無効な曜日が含まれています: ${invalid.join(', ')}`,
|
|
132
|
+
};
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
break;
|
|
136
|
+
}
|
|
137
|
+
return { valid: true };
|
|
138
|
+
}
|
|
139
|
+
/**
|
|
140
|
+
* Build a UserConfig from wizard answers
|
|
141
|
+
*/
|
|
142
|
+
static buildConfig(session) {
|
|
143
|
+
const answers = session.answers;
|
|
144
|
+
const now = new Date().toISOString();
|
|
145
|
+
const config = {
|
|
146
|
+
...DEFAULT_CONFIG,
|
|
147
|
+
version: '1.0.0',
|
|
148
|
+
createdAt: now,
|
|
149
|
+
lastUpdated: now,
|
|
150
|
+
user: {
|
|
151
|
+
name: answers.user_name ?? '',
|
|
152
|
+
email: answers.user_email ?? undefined,
|
|
153
|
+
timezone: answers.timezone ?? 'Asia/Tokyo',
|
|
154
|
+
role: answers.user_role ?? undefined,
|
|
155
|
+
},
|
|
156
|
+
calendar: {
|
|
157
|
+
workingHours: {
|
|
158
|
+
start: answers.work_start ?? '09:00',
|
|
159
|
+
end: answers.work_end ?? '18:00',
|
|
160
|
+
},
|
|
161
|
+
meetingHeavyDays: answers.meeting_days ?? ['Tuesday', 'Thursday'],
|
|
162
|
+
deepWorkDays: answers.deep_work_days ?? ['Monday', 'Wednesday', 'Friday'],
|
|
163
|
+
deepWorkBlocks: [],
|
|
164
|
+
timeZone: answers.timezone ?? 'Asia/Tokyo',
|
|
165
|
+
},
|
|
166
|
+
team: {
|
|
167
|
+
manager: answers.manager_name
|
|
168
|
+
? {
|
|
169
|
+
name: answers.manager_name,
|
|
170
|
+
role: 'manager',
|
|
171
|
+
keywords: ['manager', 'マネージャー', answers.manager_name.toLowerCase()],
|
|
172
|
+
}
|
|
173
|
+
: undefined,
|
|
174
|
+
frequentCollaborators: [],
|
|
175
|
+
departments: [],
|
|
176
|
+
},
|
|
177
|
+
integrations: {
|
|
178
|
+
appleReminders: {
|
|
179
|
+
enabled: answers.apple_reminders_enabled === 'yes',
|
|
180
|
+
threshold: 7,
|
|
181
|
+
unit: 'days',
|
|
182
|
+
defaultList: answers.apple_reminders_list ?? 'Reminders',
|
|
183
|
+
lists: {},
|
|
184
|
+
},
|
|
185
|
+
notion: {
|
|
186
|
+
enabled: answers.notion_enabled === 'yes',
|
|
187
|
+
threshold: 8,
|
|
188
|
+
unit: 'days',
|
|
189
|
+
databaseId: answers.notion_database_id ?? '',
|
|
190
|
+
},
|
|
191
|
+
googleCalendar: {
|
|
192
|
+
enabled: answers.google_calendar_enabled === 'yes',
|
|
193
|
+
defaultCalendar: 'primary',
|
|
194
|
+
conflictDetection: true,
|
|
195
|
+
lookAheadDays: 14,
|
|
196
|
+
},
|
|
197
|
+
},
|
|
198
|
+
preferences: {
|
|
199
|
+
language: answers.language ?? 'ja',
|
|
200
|
+
dateFormat: 'YYYY-MM-DD',
|
|
201
|
+
timeFormat: '24h',
|
|
202
|
+
},
|
|
203
|
+
priorityRules: DEFAULT_CONFIG.priorityRules,
|
|
204
|
+
estimation: DEFAULT_CONFIG.estimation,
|
|
205
|
+
reminders: DEFAULT_CONFIG.reminders,
|
|
206
|
+
};
|
|
207
|
+
return config;
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
//# sourceMappingURL=wizard.js.map
|