@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.
Files changed (127) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +168 -0
  3. package/dist/config/loader.d.ts +37 -0
  4. package/dist/config/loader.d.ts.map +1 -0
  5. package/dist/config/loader.js +95 -0
  6. package/dist/config/loader.js.map +1 -0
  7. package/dist/config/storage/file-storage.d.ts +35 -0
  8. package/dist/config/storage/file-storage.d.ts.map +1 -0
  9. package/dist/config/storage/file-storage.js +76 -0
  10. package/dist/config/storage/file-storage.js.map +1 -0
  11. package/dist/config/storage/index.d.ts +8 -0
  12. package/dist/config/storage/index.d.ts.map +1 -0
  13. package/dist/config/storage/index.js +8 -0
  14. package/dist/config/storage/index.js.map +1 -0
  15. package/dist/config/storage/session-storage.d.ts +35 -0
  16. package/dist/config/storage/session-storage.d.ts.map +1 -0
  17. package/dist/config/storage/session-storage.js +44 -0
  18. package/dist/config/storage/session-storage.js.map +1 -0
  19. package/dist/config/storage/storage-factory.d.ts +32 -0
  20. package/dist/config/storage/storage-factory.d.ts.map +1 -0
  21. package/dist/config/storage/storage-factory.js +78 -0
  22. package/dist/config/storage/storage-factory.js.map +1 -0
  23. package/dist/core/index.d.ts +6 -0
  24. package/dist/core/index.d.ts.map +1 -0
  25. package/dist/core/index.js +6 -0
  26. package/dist/core/index.js.map +1 -0
  27. package/dist/core/sage-core.d.ts +80 -0
  28. package/dist/core/sage-core.d.ts.map +1 -0
  29. package/dist/core/sage-core.js +190 -0
  30. package/dist/core/sage-core.js.map +1 -0
  31. package/dist/index.d.ts +9 -0
  32. package/dist/index.d.ts.map +1 -0
  33. package/dist/index.js +901 -0
  34. package/dist/index.js.map +1 -0
  35. package/dist/integrations/apple-reminders.d.ts +96 -0
  36. package/dist/integrations/apple-reminders.d.ts.map +1 -0
  37. package/dist/integrations/apple-reminders.js +250 -0
  38. package/dist/integrations/apple-reminders.js.map +1 -0
  39. package/dist/integrations/calendar-service.d.ts +126 -0
  40. package/dist/integrations/calendar-service.d.ts.map +1 -0
  41. package/dist/integrations/calendar-service.js +295 -0
  42. package/dist/integrations/calendar-service.js.map +1 -0
  43. package/dist/integrations/notion-mcp.d.ts +121 -0
  44. package/dist/integrations/notion-mcp.d.ts.map +1 -0
  45. package/dist/integrations/notion-mcp.js +281 -0
  46. package/dist/integrations/notion-mcp.js.map +1 -0
  47. package/dist/integrations/reminder-manager.d.ts +90 -0
  48. package/dist/integrations/reminder-manager.d.ts.map +1 -0
  49. package/dist/integrations/reminder-manager.js +182 -0
  50. package/dist/integrations/reminder-manager.js.map +1 -0
  51. package/dist/platform/adapter-factory.d.ts +22 -0
  52. package/dist/platform/adapter-factory.d.ts.map +1 -0
  53. package/dist/platform/adapter-factory.js +41 -0
  54. package/dist/platform/adapter-factory.js.map +1 -0
  55. package/dist/platform/adapters/mcp-adapter.d.ts +32 -0
  56. package/dist/platform/adapters/mcp-adapter.d.ts.map +1 -0
  57. package/dist/platform/adapters/mcp-adapter.js +52 -0
  58. package/dist/platform/adapters/mcp-adapter.js.map +1 -0
  59. package/dist/platform/adapters/skills-adapter-ios.d.ts +38 -0
  60. package/dist/platform/adapters/skills-adapter-ios.d.ts.map +1 -0
  61. package/dist/platform/adapters/skills-adapter-ios.js +59 -0
  62. package/dist/platform/adapters/skills-adapter-ios.js.map +1 -0
  63. package/dist/platform/adapters/skills-adapter-web.d.ts +36 -0
  64. package/dist/platform/adapters/skills-adapter-web.d.ts.map +1 -0
  65. package/dist/platform/adapters/skills-adapter-web.js +56 -0
  66. package/dist/platform/adapters/skills-adapter-web.js.map +1 -0
  67. package/dist/platform/detector.d.ts +60 -0
  68. package/dist/platform/detector.d.ts.map +1 -0
  69. package/dist/platform/detector.js +217 -0
  70. package/dist/platform/detector.js.map +1 -0
  71. package/dist/platform/index.d.ts +11 -0
  72. package/dist/platform/index.d.ts.map +1 -0
  73. package/dist/platform/index.js +11 -0
  74. package/dist/platform/index.js.map +1 -0
  75. package/dist/platform/types.d.ts +205 -0
  76. package/dist/platform/types.d.ts.map +1 -0
  77. package/dist/platform/types.js +33 -0
  78. package/dist/platform/types.js.map +1 -0
  79. package/dist/setup/questions.d.ts +15 -0
  80. package/dist/setup/questions.d.ts.map +1 -0
  81. package/dist/setup/questions.js +131 -0
  82. package/dist/setup/questions.js.map +1 -0
  83. package/dist/setup/wizard.d.ts +51 -0
  84. package/dist/setup/wizard.d.ts.map +1 -0
  85. package/dist/setup/wizard.js +210 -0
  86. package/dist/setup/wizard.js.map +1 -0
  87. package/dist/tools/analyze-tasks.d.ts +61 -0
  88. package/dist/tools/analyze-tasks.d.ts.map +1 -0
  89. package/dist/tools/analyze-tasks.js +258 -0
  90. package/dist/tools/analyze-tasks.js.map +1 -0
  91. package/dist/types/config.d.ts +126 -0
  92. package/dist/types/config.d.ts.map +1 -0
  93. package/dist/types/config.js +118 -0
  94. package/dist/types/config.js.map +1 -0
  95. package/dist/types/errors.d.ts +39 -0
  96. package/dist/types/errors.d.ts.map +1 -0
  97. package/dist/types/errors.js +83 -0
  98. package/dist/types/errors.js.map +1 -0
  99. package/dist/types/index.d.ts +7 -0
  100. package/dist/types/index.d.ts.map +1 -0
  101. package/dist/types/index.js +7 -0
  102. package/dist/types/index.js.map +1 -0
  103. package/dist/types/task.d.ts +69 -0
  104. package/dist/types/task.d.ts.map +1 -0
  105. package/dist/types/task.js +5 -0
  106. package/dist/types/task.js.map +1 -0
  107. package/dist/utils/estimation.d.ts +49 -0
  108. package/dist/utils/estimation.d.ts.map +1 -0
  109. package/dist/utils/estimation.js +244 -0
  110. package/dist/utils/estimation.js.map +1 -0
  111. package/dist/utils/priority.d.ts +68 -0
  112. package/dist/utils/priority.d.ts.map +1 -0
  113. package/dist/utils/priority.js +243 -0
  114. package/dist/utils/priority.js.map +1 -0
  115. package/dist/utils/retry.d.ts +62 -0
  116. package/dist/utils/retry.d.ts.map +1 -0
  117. package/dist/utils/retry.js +161 -0
  118. package/dist/utils/retry.js.map +1 -0
  119. package/dist/utils/stakeholders.d.ts +61 -0
  120. package/dist/utils/stakeholders.d.ts.map +1 -0
  121. package/dist/utils/stakeholders.js +301 -0
  122. package/dist/utils/stakeholders.js.map +1 -0
  123. package/dist/utils/task-splitter.d.ts +45 -0
  124. package/dist/utils/task-splitter.d.ts.map +1 -0
  125. package/dist/utils/task-splitter.js +321 -0
  126. package/dist/utils/task-splitter.js.map +1 -0
  127. package/package.json +66 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 shin1ohno
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,168 @@
1
+ # sage (賢者)
2
+
3
+ AI Task Management Assistant MCP Server for Claude Desktop and Claude Code.
4
+
5
+ ## Features
6
+
7
+ - **Task Analysis**: Automatic priority assignment (P0-P3), time estimation, stakeholder extraction
8
+ - **Task Splitting**: Break complex tasks into actionable subtasks
9
+ - **Apple Reminders Integration**: Create reminders via AppleScript (macOS) or native API (iOS/iPadOS)
10
+ - **Notion Integration**: Sync long-term tasks (8+ days) to Notion via MCP
11
+ - **Calendar Integration**: Find available time slots based on your schedule
12
+ - **Smart Routing**: Automatically route tasks to Apple Reminders (≤7 days) or Notion (8+ days)
13
+
14
+ ## Installation
15
+
16
+ ### Claude Desktop
17
+
18
+ Add to your Claude Desktop configuration (`~/Library/Application Support/Claude/claude_desktop_config.json`):
19
+
20
+ ```json
21
+ {
22
+ "mcpServers": {
23
+ "sage": {
24
+ "command": "npx",
25
+ "args": ["-y", "@shin1ohno/sage"]
26
+ }
27
+ }
28
+ }
29
+ ```
30
+
31
+ ### Claude Code
32
+
33
+ ```bash
34
+ claude mcp add sage -- npx -y @shin1ohno/sage
35
+ ```
36
+
37
+ ### Manual Installation
38
+
39
+ ```bash
40
+ npm install -g @shin1ohno/sage
41
+ ```
42
+
43
+ ## Setup
44
+
45
+ On first use, sage will guide you through setup:
46
+
47
+ 1. Run `check_setup_status` to see if configuration is needed
48
+ 2. Run `start_setup_wizard` to begin interactive setup
49
+ 3. Answer questions about your preferences (name, working hours, team, etc.)
50
+ 4. Run `save_config` to save your configuration
51
+
52
+ Configuration is stored at `~/.sage/config.json`.
53
+
54
+ ## Tools
55
+
56
+ ### Setup & Configuration
57
+
58
+ | Tool | Description |
59
+ |------|-------------|
60
+ | `check_setup_status` | Check if sage has been configured |
61
+ | `start_setup_wizard` | Start the interactive setup wizard |
62
+ | `answer_wizard_question` | Answer a setup wizard question |
63
+ | `save_config` | Save configuration after setup |
64
+ | `update_config` | Update sage configuration |
65
+
66
+ ### Task Management
67
+
68
+ | Tool | Description |
69
+ |------|-------------|
70
+ | `analyze_tasks` | Analyze tasks for priority, time estimation, and stakeholders |
71
+ | `set_reminder` | Set a reminder in Apple Reminders or Notion |
72
+ | `find_available_slots` | Find available time slots in calendar |
73
+ | `sync_to_notion` | Sync a task to Notion database |
74
+
75
+ ## Example Usage
76
+
77
+ ### Analyze Tasks
78
+
79
+ ```
80
+ analyze_tasks with tasks:
81
+ - title: "Review PR from Alice"
82
+ deadline: "2025-01-02T17:00:00"
83
+ - title: "Prepare quarterly report"
84
+ description: "Q4 summary for manager"
85
+ ```
86
+
87
+ ### Set Reminder
88
+
89
+ ```
90
+ set_reminder with:
91
+ - taskTitle: "Submit expense report"
92
+ - dueDate: "2025-01-03T12:00:00"
93
+ - priority: "P1"
94
+ ```
95
+
96
+ ### Find Available Slots
97
+
98
+ ```
99
+ find_available_slots with:
100
+ - durationMinutes: 60
101
+ - preferDeepWork: true
102
+ ```
103
+
104
+ ## Platform Support
105
+
106
+ | Platform | Apple Reminders | Calendar | Notion |
107
+ |----------|----------------|----------|--------|
108
+ | macOS | AppleScript | AppleScript | MCP |
109
+ | iOS/iPadOS | Native API | Native API | Fallback |
110
+ | Windows/Linux | Fallback text | Manual input | MCP |
111
+
112
+ ## Configuration
113
+
114
+ Example `~/.sage/config.json`:
115
+
116
+ ```json
117
+ {
118
+ "user": {
119
+ "name": "Your Name",
120
+ "timezone": "Asia/Tokyo"
121
+ },
122
+ "calendar": {
123
+ "workingHours": {
124
+ "start": "09:00",
125
+ "end": "18:00"
126
+ },
127
+ "deepWorkDays": ["Tuesday", "Thursday"],
128
+ "meetingHeavyDays": ["Monday", "Friday"]
129
+ },
130
+ "integrations": {
131
+ "appleReminders": {
132
+ "enabled": true,
133
+ "defaultList": "Reminders"
134
+ },
135
+ "notion": {
136
+ "enabled": true,
137
+ "databaseId": "your-database-id",
138
+ "threshold": 8
139
+ }
140
+ }
141
+ }
142
+ ```
143
+
144
+ ## Requirements
145
+
146
+ - Node.js >= 18.0.0
147
+ - macOS (for Apple Reminders/Calendar integration)
148
+ - Notion MCP server (for Notion integration)
149
+
150
+ ## Development
151
+
152
+ ```bash
153
+ # Install dependencies
154
+ npm install
155
+
156
+ # Run in development mode
157
+ npm run dev
158
+
159
+ # Run tests
160
+ npm test
161
+
162
+ # Build
163
+ npm run build
164
+ ```
165
+
166
+ ## License
167
+
168
+ MIT
@@ -0,0 +1,37 @@
1
+ /**
2
+ * Configuration file loader
3
+ * Handles reading and writing the sage configuration file
4
+ */
5
+ import type { UserConfig } from '../types/index.js';
6
+ export declare class ConfigLoader {
7
+ /**
8
+ * Get the path to the sage configuration directory
9
+ */
10
+ static getConfigDir(): string;
11
+ /**
12
+ * Get the path to the configuration file
13
+ */
14
+ static getConfigPath(): string;
15
+ /**
16
+ * Check if the configuration file exists
17
+ */
18
+ static exists(): Promise<boolean>;
19
+ /**
20
+ * Load the configuration from disk
21
+ * Throws if the file doesn't exist or is invalid
22
+ */
23
+ static load(): Promise<UserConfig>;
24
+ /**
25
+ * Save the configuration to disk
26
+ */
27
+ static save(config: UserConfig): Promise<void>;
28
+ /**
29
+ * Get the default configuration
30
+ */
31
+ static getDefaultConfig(): UserConfig;
32
+ /**
33
+ * Merge partial updates into an existing configuration
34
+ */
35
+ static mergeConfig(base: UserConfig, updates: Partial<UserConfig>): UserConfig;
36
+ }
37
+ //# sourceMappingURL=loader.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"loader.d.ts","sourceRoot":"","sources":["../../src/config/loader.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAMpD,qBAAa,YAAY;IACvB;;OAEG;IACH,MAAM,CAAC,YAAY,IAAI,MAAM;IAI7B;;OAEG;IACH,MAAM,CAAC,aAAa,IAAI,MAAM;IAI9B;;OAEG;WACU,MAAM,IAAI,OAAO,CAAC,OAAO,CAAC;IASvC;;;OAGG;WACU,IAAI,IAAI,OAAO,CAAC,UAAU,CAAC;IAqBxC;;OAEG;WACU,IAAI,CAAC,MAAM,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC;IAiBpD;;OAEG;IACH,MAAM,CAAC,gBAAgB,IAAI,UAAU;IAQrC;;OAEG;IACH,MAAM,CAAC,WAAW,CAAC,IAAI,EAAE,UAAU,EAAE,OAAO,EAAE,OAAO,CAAC,UAAU,CAAC,GAAG,UAAU;CAO/E"}
@@ -0,0 +1,95 @@
1
+ /**
2
+ * Configuration file loader
3
+ * Handles reading and writing the sage configuration file
4
+ */
5
+ import { readFile, writeFile, mkdir, access } from 'node:fs/promises';
6
+ import { homedir } from 'node:os';
7
+ import { join } from 'node:path';
8
+ import { DEFAULT_CONFIG } from '../types/config.js';
9
+ const SAGE_DIR = '.sage';
10
+ const CONFIG_FILE = 'config.json';
11
+ export class ConfigLoader {
12
+ /**
13
+ * Get the path to the sage configuration directory
14
+ */
15
+ static getConfigDir() {
16
+ return join(homedir(), SAGE_DIR);
17
+ }
18
+ /**
19
+ * Get the path to the configuration file
20
+ */
21
+ static getConfigPath() {
22
+ return join(this.getConfigDir(), CONFIG_FILE);
23
+ }
24
+ /**
25
+ * Check if the configuration file exists
26
+ */
27
+ static async exists() {
28
+ try {
29
+ await access(this.getConfigPath());
30
+ return true;
31
+ }
32
+ catch {
33
+ return false;
34
+ }
35
+ }
36
+ /**
37
+ * Load the configuration from disk
38
+ * Throws if the file doesn't exist or is invalid
39
+ */
40
+ static async load() {
41
+ const configPath = this.getConfigPath();
42
+ try {
43
+ const content = await readFile(configPath, 'utf-8');
44
+ const parsed = JSON.parse(content);
45
+ // Validate basic structure
46
+ if (!parsed.version || !parsed.user) {
47
+ throw new Error('Invalid configuration file structure');
48
+ }
49
+ return parsed;
50
+ }
51
+ catch (error) {
52
+ if (error.code === 'ENOENT') {
53
+ throw new Error('Configuration file not found');
54
+ }
55
+ throw error;
56
+ }
57
+ }
58
+ /**
59
+ * Save the configuration to disk
60
+ */
61
+ static async save(config) {
62
+ const configDir = this.getConfigDir();
63
+ const configPath = this.getConfigPath();
64
+ // Ensure the directory exists
65
+ await mkdir(configDir, { recursive: true });
66
+ // Update timestamp
67
+ const updatedConfig = {
68
+ ...config,
69
+ lastUpdated: new Date().toISOString(),
70
+ };
71
+ // Write the file with pretty formatting
72
+ await writeFile(configPath, JSON.stringify(updatedConfig, null, 2), 'utf-8');
73
+ }
74
+ /**
75
+ * Get the default configuration
76
+ */
77
+ static getDefaultConfig() {
78
+ return {
79
+ ...DEFAULT_CONFIG,
80
+ createdAt: new Date().toISOString(),
81
+ lastUpdated: new Date().toISOString(),
82
+ };
83
+ }
84
+ /**
85
+ * Merge partial updates into an existing configuration
86
+ */
87
+ static mergeConfig(base, updates) {
88
+ return {
89
+ ...base,
90
+ ...updates,
91
+ lastUpdated: new Date().toISOString(),
92
+ };
93
+ }
94
+ }
95
+ //# sourceMappingURL=loader.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"loader.js","sourceRoot":"","sources":["../../src/config/loader.ts"],"names":[],"mappings":"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"}
@@ -0,0 +1,35 @@
1
+ /**
2
+ * File Config Storage
3
+ * Stores configuration in the file system (for Desktop/Code MCP)
4
+ * Requirements: 1.1, 1.5
5
+ */
6
+ import type { ConfigStorage } from '../../platform/types.js';
7
+ /**
8
+ * File-based configuration storage
9
+ * Used for Desktop/Code MCP environment
10
+ */
11
+ export declare class FileConfigStorage implements ConfigStorage {
12
+ private filePath;
13
+ constructor(filePath?: string);
14
+ /**
15
+ * Load configuration from file
16
+ */
17
+ load(): Promise<Record<string, unknown> | null>;
18
+ /**
19
+ * Save configuration to file
20
+ */
21
+ save(config: Record<string, unknown>): Promise<void>;
22
+ /**
23
+ * Check if configuration file exists
24
+ */
25
+ exists(): Promise<boolean>;
26
+ /**
27
+ * Delete configuration file
28
+ */
29
+ delete(): Promise<void>;
30
+ /**
31
+ * Get the file path
32
+ */
33
+ getFilePath(): string;
34
+ }
35
+ //# sourceMappingURL=file-storage.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"file-storage.d.ts","sourceRoot":"","sources":["../../../src/config/storage/file-storage.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAKH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAE7D;;;GAGG;AACH,qBAAa,iBAAkB,YAAW,aAAa;IACrD,OAAO,CAAC,QAAQ,CAAS;gBAEb,QAAQ,CAAC,EAAE,MAAM;IAI7B;;OAEG;IACG,IAAI,IAAI,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC;IAYrD;;OAEG;IACG,IAAI,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;IAS1D;;OAEG;IACG,MAAM,IAAI,OAAO,CAAC,OAAO,CAAC;IAShC;;OAEG;IACG,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC;IAW7B;;OAEG;IACH,WAAW,IAAI,MAAM;CAGtB"}
@@ -0,0 +1,76 @@
1
+ /**
2
+ * File Config Storage
3
+ * Stores configuration in the file system (for Desktop/Code MCP)
4
+ * Requirements: 1.1, 1.5
5
+ */
6
+ import * as fs from 'fs/promises';
7
+ import * as path from 'path';
8
+ import * as os from 'os';
9
+ /**
10
+ * File-based configuration storage
11
+ * Used for Desktop/Code MCP environment
12
+ */
13
+ export class FileConfigStorage {
14
+ filePath;
15
+ constructor(filePath) {
16
+ this.filePath = filePath ?? path.join(os.homedir(), '.sage', 'config.json');
17
+ }
18
+ /**
19
+ * Load configuration from file
20
+ */
21
+ async load() {
22
+ try {
23
+ const data = await fs.readFile(this.filePath, 'utf-8');
24
+ return JSON.parse(data);
25
+ }
26
+ catch (error) {
27
+ if (error.code === 'ENOENT') {
28
+ throw new Error(`Configuration file not found: ${this.filePath}`);
29
+ }
30
+ throw error;
31
+ }
32
+ }
33
+ /**
34
+ * Save configuration to file
35
+ */
36
+ async save(config) {
37
+ // Ensure directory exists
38
+ const dir = path.dirname(this.filePath);
39
+ await fs.mkdir(dir, { recursive: true });
40
+ // Write config
41
+ await fs.writeFile(this.filePath, JSON.stringify(config, null, 2), 'utf-8');
42
+ }
43
+ /**
44
+ * Check if configuration file exists
45
+ */
46
+ async exists() {
47
+ try {
48
+ await fs.access(this.filePath);
49
+ return true;
50
+ }
51
+ catch {
52
+ return false;
53
+ }
54
+ }
55
+ /**
56
+ * Delete configuration file
57
+ */
58
+ async delete() {
59
+ try {
60
+ await fs.unlink(this.filePath);
61
+ }
62
+ catch (error) {
63
+ if (error.code !== 'ENOENT') {
64
+ throw error;
65
+ }
66
+ // File doesn't exist, that's fine
67
+ }
68
+ }
69
+ /**
70
+ * Get the file path
71
+ */
72
+ getFilePath() {
73
+ return this.filePath;
74
+ }
75
+ }
76
+ //# sourceMappingURL=file-storage.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"file-storage.js","sourceRoot":"","sources":["../../../src/config/storage/file-storage.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,MAAM,aAAa,CAAC;AAClC,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAC7B,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AAGzB;;;GAGG;AACH,MAAM,OAAO,iBAAiB;IACpB,QAAQ,CAAS;IAEzB,YAAY,QAAiB;QAC3B,IAAI,CAAC,QAAQ,GAAG,QAAQ,IAAI,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,OAAO,EAAE,EAAE,OAAO,EAAE,aAAa,CAAC,CAAC;IAC9E,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,IAAI;QACR,IAAI,CAAC;YACH,MAAM,IAAI,GAAG,MAAM,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;YACvD,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QAC1B,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,IAAK,KAA+B,CAAC,IAAI,KAAK,QAAQ,EAAE,CAAC;gBACvD,MAAM,IAAI,KAAK,CAAC,iCAAiC,IAAI,CAAC,QAAQ,EAAE,CAAC,CAAC;YACpE,CAAC;YACD,MAAM,KAAK,CAAC;QACd,CAAC;IACH,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,IAAI,CAAC,MAA+B;QACxC,0BAA0B;QAC1B,MAAM,GAAG,GAAG,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QACxC,MAAM,EAAE,CAAC,KAAK,CAAC,GAAG,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;QAEzC,eAAe;QACf,MAAM,EAAE,CAAC,SAAS,CAAC,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC;IAC9E,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,MAAM;QACV,IAAI,CAAC;YACH,MAAM,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;YAC/B,OAAO,IAAI,CAAC;QACd,CAAC;QAAC,MAAM,CAAC;YACP,OAAO,KAAK,CAAC;QACf,CAAC;IACH,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,MAAM;QACV,IAAI,CAAC;YACH,MAAM,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QACjC,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,IAAK,KAA+B,CAAC,IAAI,KAAK,QAAQ,EAAE,CAAC;gBACvD,MAAM,KAAK,CAAC;YACd,CAAC;YACD,kCAAkC;QACpC,CAAC;IACH,CAAC;IAED;;OAEG;IACH,WAAW;QACT,OAAO,IAAI,CAAC,QAAQ,CAAC;IACvB,CAAC;CACF"}
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Config Storage Module
3
+ * Exports platform-specific storage implementations
4
+ */
5
+ export * from './file-storage.js';
6
+ export * from './session-storage.js';
7
+ export * from './storage-factory.js';
8
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/config/storage/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,cAAc,mBAAmB,CAAC;AAClC,cAAc,sBAAsB,CAAC;AACrC,cAAc,sBAAsB,CAAC"}
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Config Storage Module
3
+ * Exports platform-specific storage implementations
4
+ */
5
+ export * from './file-storage.js';
6
+ export * from './session-storage.js';
7
+ export * from './storage-factory.js';
8
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/config/storage/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,cAAc,mBAAmB,CAAC;AAClC,cAAc,sBAAsB,CAAC;AACrC,cAAc,sBAAsB,CAAC"}
@@ -0,0 +1,35 @@
1
+ /**
2
+ * Session Config Storage
3
+ * Stores configuration in memory for Skills environments
4
+ * Requirements: 1.1, 10.1
5
+ */
6
+ import type { ConfigStorage } from '../../platform/types.js';
7
+ /**
8
+ * Session-based configuration storage
9
+ * Used for iOS/iPadOS and Web Skills environments
10
+ * Note: iOS/iPadOS may sync to iCloud in future implementations
11
+ */
12
+ export declare class SessionConfigStorage implements ConfigStorage {
13
+ private config;
14
+ /**
15
+ * Load configuration from session
16
+ */
17
+ load(): Promise<Record<string, unknown> | null>;
18
+ /**
19
+ * Save configuration to session
20
+ */
21
+ save(config: Record<string, unknown>): Promise<void>;
22
+ /**
23
+ * Check if configuration exists in session
24
+ */
25
+ exists(): Promise<boolean>;
26
+ /**
27
+ * Delete configuration from session
28
+ */
29
+ delete(): Promise<void>;
30
+ /**
31
+ * Clear all session data
32
+ */
33
+ clear(): void;
34
+ }
35
+ //# sourceMappingURL=session-storage.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"session-storage.d.ts","sourceRoot":"","sources":["../../../src/config/storage/session-storage.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAE7D;;;;GAIG;AACH,qBAAa,oBAAqB,YAAW,aAAa;IACxD,OAAO,CAAC,MAAM,CAAwC;IAEtD;;OAEG;IACG,IAAI,IAAI,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC;IAIrD;;OAEG;IACG,IAAI,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;IAI1D;;OAEG;IACG,MAAM,IAAI,OAAO,CAAC,OAAO,CAAC;IAIhC;;OAEG;IACG,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC;IAI7B;;OAEG;IACH,KAAK,IAAI,IAAI;CAGd"}
@@ -0,0 +1,44 @@
1
+ /**
2
+ * Session Config Storage
3
+ * Stores configuration in memory for Skills environments
4
+ * Requirements: 1.1, 10.1
5
+ */
6
+ /**
7
+ * Session-based configuration storage
8
+ * Used for iOS/iPadOS and Web Skills environments
9
+ * Note: iOS/iPadOS may sync to iCloud in future implementations
10
+ */
11
+ export class SessionConfigStorage {
12
+ config = null;
13
+ /**
14
+ * Load configuration from session
15
+ */
16
+ async load() {
17
+ return this.config;
18
+ }
19
+ /**
20
+ * Save configuration to session
21
+ */
22
+ async save(config) {
23
+ this.config = { ...config };
24
+ }
25
+ /**
26
+ * Check if configuration exists in session
27
+ */
28
+ async exists() {
29
+ return this.config !== null;
30
+ }
31
+ /**
32
+ * Delete configuration from session
33
+ */
34
+ async delete() {
35
+ this.config = null;
36
+ }
37
+ /**
38
+ * Clear all session data
39
+ */
40
+ clear() {
41
+ this.config = null;
42
+ }
43
+ }
44
+ //# sourceMappingURL=session-storage.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"session-storage.js","sourceRoot":"","sources":["../../../src/config/storage/session-storage.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH;;;;GAIG;AACH,MAAM,OAAO,oBAAoB;IACvB,MAAM,GAAmC,IAAI,CAAC;IAEtD;;OAEG;IACH,KAAK,CAAC,IAAI;QACR,OAAO,IAAI,CAAC,MAAM,CAAC;IACrB,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,IAAI,CAAC,MAA+B;QACxC,IAAI,CAAC,MAAM,GAAG,EAAE,GAAG,MAAM,EAAE,CAAC;IAC9B,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,MAAM;QACV,OAAO,IAAI,CAAC,MAAM,KAAK,IAAI,CAAC;IAC9B,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,MAAM;QACV,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC;IACrB,CAAC;IAED;;OAEG;IACH,KAAK;QACH,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC;IACrB,CAAC;CACF"}
@@ -0,0 +1,32 @@
1
+ /**
2
+ * Config Storage Factory
3
+ * Creates appropriate storage based on platform
4
+ * Requirements: 1.1, 1.5, 10.1
5
+ */
6
+ import type { ConfigStorage, PlatformType } from '../../platform/types.js';
7
+ /**
8
+ * Storage type enumeration
9
+ */
10
+ export type StorageType = 'file' | 'session' | 'icloud';
11
+ /**
12
+ * Factory for creating platform-specific config storage
13
+ */
14
+ export declare class ConfigStorageFactory {
15
+ /**
16
+ * Create storage based on platform type
17
+ */
18
+ static create(platformType: PlatformType): ConfigStorage;
19
+ /**
20
+ * Get storage type for a platform
21
+ */
22
+ static getStorageType(platformType: PlatformType): StorageType;
23
+ /**
24
+ * Check if storage is persistent across sessions
25
+ */
26
+ static isPersistent(platformType: PlatformType): boolean;
27
+ /**
28
+ * Get storage description for user display
29
+ */
30
+ static getStorageDescription(platformType: PlatformType): string;
31
+ }
32
+ //# sourceMappingURL=storage-factory.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"storage-factory.d.ts","sourceRoot":"","sources":["../../../src/config/storage/storage-factory.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAI3E;;GAEG;AACH,MAAM,MAAM,WAAW,GAAG,MAAM,GAAG,SAAS,GAAG,QAAQ,CAAC;AAExD;;GAEG;AACH,qBAAa,oBAAoB;IAC/B;;OAEG;IACH,MAAM,CAAC,MAAM,CAAC,YAAY,EAAE,YAAY,GAAG,aAAa;IAmBxD;;OAEG;IACH,MAAM,CAAC,cAAc,CAAC,YAAY,EAAE,YAAY,GAAG,WAAW;IAgB9D;;OAEG;IACH,MAAM,CAAC,YAAY,CAAC,YAAY,EAAE,YAAY,GAAG,OAAO;IAgBxD;;OAEG;IACH,MAAM,CAAC,qBAAqB,CAAC,YAAY,EAAE,YAAY,GAAG,MAAM;CAcjE"}