prjct-cli 0.31.0 → 0.34.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/CHANGELOG.md +183 -0
- package/CLAUDE.md +41 -0
- package/core/__tests__/agentic/memory-system.test.ts +2 -2
- package/core/__tests__/types/fs.test.ts +125 -0
- package/core/agentic/agent-router.ts +16 -4
- package/core/agentic/chain-of-thought.ts +4 -12
- package/core/agentic/command-executor.ts +10 -11
- package/core/agentic/context-builder.ts +24 -10
- package/core/agentic/ground-truth.ts +139 -55
- package/core/agentic/prompt-builder.ts +20 -7
- package/core/agentic/smart-context.ts +1 -1
- package/core/agentic/template-loader.ts +1 -1
- package/core/agentic/tool-registry.ts +4 -2
- package/core/bus/bus.ts +1 -1
- package/core/commands/cleanup.ts +24 -8
- package/core/commands/planning.ts +4 -2
- package/core/commands/setup.ts +4 -4
- package/core/commands/shipping.ts +34 -8
- package/core/commands/snapshots.ts +27 -13
- package/core/context/generator.ts +9 -5
- package/core/domain/agent-generator.ts +1 -1
- package/core/domain/agent-loader.ts +1 -1
- package/core/domain/analyzer.ts +76 -31
- package/core/domain/context-estimator.ts +1 -1
- package/core/domain/snapshot-manager.ts +55 -21
- package/core/domain/task-stack.ts +16 -7
- package/core/infrastructure/author-detector.ts +1 -1
- package/core/infrastructure/claude-agent.ts +12 -8
- package/core/infrastructure/command-installer.ts +42 -21
- package/core/infrastructure/editors-config.ts +1 -1
- package/core/infrastructure/path-manager.ts +27 -2
- package/core/infrastructure/permission-manager.ts +1 -1
- package/core/infrastructure/setup.ts +31 -13
- package/core/infrastructure/update-checker.ts +5 -5
- package/core/integrations/jira/client.ts +91 -30
- package/core/integrations/jira/index.ts +29 -5
- package/core/integrations/jira/mcp-adapter.ts +451 -0
- package/core/integrations/linear/client.ts +23 -3
- package/core/plugin/loader.ts +16 -6
- package/core/plugin/registry.ts +16 -6
- package/core/server/routes-extended.ts +13 -6
- package/core/server/routes.ts +15 -5
- package/core/server/sse.ts +4 -3
- package/core/services/agent-service.ts +4 -2
- package/core/services/memory-service.ts +16 -5
- package/core/services/project-service.ts +11 -2
- package/core/services/skill-service.ts +4 -3
- package/core/session/compaction.ts +4 -5
- package/core/session/metrics.ts +11 -4
- package/core/session/task-session-manager.ts +27 -9
- package/core/storage/storage-manager.ts +12 -5
- package/core/storage/storage.ts +26 -10
- package/core/sync/auth-config.ts +2 -2
- package/core/sync/oauth-handler.ts +1 -1
- package/core/sync/sync-client.ts +4 -2
- package/core/sync/sync-manager.ts +1 -1
- package/core/types/agentic.ts +8 -18
- package/core/types/config.ts +1 -1
- package/core/types/index.ts +3 -2
- package/core/types/integrations.ts +4 -48
- package/core/types/storage.ts +0 -8
- package/core/types/task.ts +0 -4
- package/core/utils/file-helper.ts +10 -4
- package/core/utils/jsonl-helper.ts +4 -4
- package/core/utils/keychain.ts +130 -0
- package/core/utils/logger.ts +27 -25
- package/core/utils/runtime.ts +1 -1
- package/core/utils/session-helper.ts +4 -4
- package/core/utils/version.ts +1 -1
- package/package.json +1 -1
- package/packages/shared/src/utils.ts +1 -1
- package/scripts/postinstall.js +26 -2
- package/templates/agentic/orchestrator.md +303 -0
- package/templates/commands/bug.md +2 -0
- package/templates/commands/enrich.md +601 -195
- package/templates/commands/github.md +287 -0
- package/templates/commands/init.md +45 -26
- package/templates/commands/jira.md +198 -258
- package/templates/commands/linear.md +186 -172
- package/templates/commands/monday.md +232 -0
- package/templates/commands/p.md +57 -10
- package/templates/commands/setup.md +4 -1
- package/templates/commands/sync.md +133 -97
- package/templates/commands/task.md +12 -0
- package/templates/config/skill-mappings.json +95 -63
- package/templates/mcp-config.json +42 -39
- package/core/integrations/notion/client.ts +0 -413
- package/core/integrations/notion/index.ts +0 -46
- package/core/integrations/notion/setup.ts +0 -235
- package/core/integrations/notion/sync.ts +0 -818
- package/core/integrations/notion/templates.ts +0 -246
- package/core/plugin/builtin/notion.ts +0 -178
- package/dist/bin/prjct.mjs +0 -13581
- package/dist/core/infrastructure/command-installer.js +0 -473
- package/dist/core/infrastructure/editors-config.js +0 -157
- package/dist/core/infrastructure/setup.js +0 -893
- package/dist/core/utils/version.js +0 -142
- package/packages/shared/.turbo/turbo-build.log +0 -14
- package/packages/shared/dist/index.d.ts +0 -10
- package/packages/shared/dist/index.d.ts.map +0 -1
- package/packages/shared/dist/index.js +0 -4196
- package/packages/shared/dist/schemas.d.ts +0 -408
- package/packages/shared/dist/schemas.d.ts.map +0 -1
- package/packages/shared/dist/types.d.ts +0 -144
- package/packages/shared/dist/types.d.ts.map +0 -1
- package/packages/shared/dist/unified.d.ts +0 -139
- package/packages/shared/dist/unified.d.ts.map +0 -1
- package/packages/shared/dist/utils.d.ts +0 -60
- package/packages/shared/dist/utils.d.ts.map +0 -1
- package/templates/commands/ask.md +0 -128
- package/templates/commands/dashboard.md +0 -686
- package/templates/commands/feature.md +0 -46
- package/templates/commands/now.md +0 -53
- package/templates/commands/suggest.md +0 -116
- package/templates/global/docs/agents.md +0 -88
- package/templates/global/docs/architecture.md +0 -103
- package/templates/global/docs/commands.md +0 -96
- package/templates/global/docs/validation.md +0 -95
- package/templates/skills/notion-push.md +0 -116
- package/templates/skills/notion-setup.md +0 -199
- package/templates/skills/notion-sync.md +0 -290
|
@@ -1,246 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Notion Database Templates
|
|
3
|
-
* Schemas for auto-creating prjct databases in Notion.
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
import type { NotionDatabaseSchema } from './client'
|
|
7
|
-
|
|
8
|
-
// =============================================================================
|
|
9
|
-
// Database Schemas
|
|
10
|
-
// =============================================================================
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* Shipped Features Database Schema
|
|
14
|
-
* Tracks shipped features with metrics
|
|
15
|
-
*/
|
|
16
|
-
export const SHIPPED_DATABASE_SCHEMA: NotionDatabaseSchema = {
|
|
17
|
-
title: 'prjct: Shipped Features',
|
|
18
|
-
properties: {
|
|
19
|
-
Name: { type: 'title', title: {} },
|
|
20
|
-
Version: { type: 'rich_text', rich_text: {} },
|
|
21
|
-
Type: {
|
|
22
|
-
type: 'select',
|
|
23
|
-
select: {
|
|
24
|
-
options: [
|
|
25
|
-
{ name: 'feature', color: 'blue' },
|
|
26
|
-
{ name: 'fix', color: 'red' },
|
|
27
|
-
{ name: 'improvement', color: 'green' },
|
|
28
|
-
{ name: 'refactor', color: 'purple' },
|
|
29
|
-
],
|
|
30
|
-
},
|
|
31
|
-
},
|
|
32
|
-
'Shipped Date': { type: 'date', date: {} },
|
|
33
|
-
'Lines Changed': { type: 'number', number: { format: 'number' } },
|
|
34
|
-
'Files Changed': { type: 'number', number: { format: 'number' } },
|
|
35
|
-
Commits: { type: 'number', number: { format: 'number' } },
|
|
36
|
-
Duration: { type: 'rich_text', rich_text: {} },
|
|
37
|
-
Description: { type: 'rich_text', rich_text: {} },
|
|
38
|
-
},
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
/**
|
|
42
|
-
* Roadmap Database Schema
|
|
43
|
-
* Tracks feature roadmap and progress
|
|
44
|
-
*/
|
|
45
|
-
export const ROADMAP_DATABASE_SCHEMA: NotionDatabaseSchema = {
|
|
46
|
-
title: 'prjct: Roadmap',
|
|
47
|
-
properties: {
|
|
48
|
-
Feature: { type: 'title', title: {} },
|
|
49
|
-
Status: {
|
|
50
|
-
type: 'status',
|
|
51
|
-
status: {
|
|
52
|
-
options: [
|
|
53
|
-
{ name: 'Planned', color: 'gray' },
|
|
54
|
-
{ name: 'Active', color: 'blue' },
|
|
55
|
-
{ name: 'Completed', color: 'green' },
|
|
56
|
-
{ name: 'Shipped', color: 'purple' },
|
|
57
|
-
],
|
|
58
|
-
groups: [
|
|
59
|
-
{ name: 'To Do', option_ids: [], color: 'gray' },
|
|
60
|
-
{ name: 'In Progress', option_ids: [], color: 'blue' },
|
|
61
|
-
{ name: 'Done', option_ids: [], color: 'green' },
|
|
62
|
-
],
|
|
63
|
-
},
|
|
64
|
-
},
|
|
65
|
-
Priority: {
|
|
66
|
-
type: 'select',
|
|
67
|
-
select: {
|
|
68
|
-
options: [
|
|
69
|
-
{ name: 'High', color: 'red' },
|
|
70
|
-
{ name: 'Medium', color: 'yellow' },
|
|
71
|
-
{ name: 'Low', color: 'gray' },
|
|
72
|
-
],
|
|
73
|
-
},
|
|
74
|
-
},
|
|
75
|
-
Progress: { type: 'number', number: { format: 'percent' } },
|
|
76
|
-
Phase: { type: 'rich_text', rich_text: {} },
|
|
77
|
-
'Target Date': { type: 'date', date: {} },
|
|
78
|
-
Description: { type: 'rich_text', rich_text: {} },
|
|
79
|
-
Tasks: { type: 'number', number: { format: 'number' } },
|
|
80
|
-
},
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
/**
|
|
84
|
-
* Ideas Database Schema
|
|
85
|
-
* Captures and tracks ideas
|
|
86
|
-
*/
|
|
87
|
-
export const IDEAS_DATABASE_SCHEMA: NotionDatabaseSchema = {
|
|
88
|
-
title: 'prjct: Ideas',
|
|
89
|
-
properties: {
|
|
90
|
-
Idea: { type: 'title', title: {} },
|
|
91
|
-
Status: {
|
|
92
|
-
type: 'status',
|
|
93
|
-
status: {
|
|
94
|
-
options: [
|
|
95
|
-
{ name: 'Pending', color: 'gray' },
|
|
96
|
-
{ name: 'Converted', color: 'green' },
|
|
97
|
-
{ name: 'Archived', color: 'default' },
|
|
98
|
-
],
|
|
99
|
-
groups: [
|
|
100
|
-
{ name: 'Not Started', option_ids: [], color: 'gray' },
|
|
101
|
-
{ name: 'Done', option_ids: [], color: 'green' },
|
|
102
|
-
],
|
|
103
|
-
},
|
|
104
|
-
},
|
|
105
|
-
Priority: {
|
|
106
|
-
type: 'select',
|
|
107
|
-
select: {
|
|
108
|
-
options: [
|
|
109
|
-
{ name: 'high', color: 'red' },
|
|
110
|
-
{ name: 'medium', color: 'yellow' },
|
|
111
|
-
{ name: 'low', color: 'gray' },
|
|
112
|
-
],
|
|
113
|
-
},
|
|
114
|
-
},
|
|
115
|
-
Tags: { type: 'multi_select', multi_select: { options: [] } },
|
|
116
|
-
Created: { type: 'date', date: {} },
|
|
117
|
-
'Converted To': { type: 'rich_text', rich_text: {} },
|
|
118
|
-
},
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
/**
|
|
122
|
-
* Active Tasks Database Schema
|
|
123
|
-
* Tracks current task queue
|
|
124
|
-
*/
|
|
125
|
-
export const TASKS_DATABASE_SCHEMA: NotionDatabaseSchema = {
|
|
126
|
-
title: 'prjct: Active Tasks',
|
|
127
|
-
properties: {
|
|
128
|
-
Task: { type: 'title', title: {} },
|
|
129
|
-
Priority: {
|
|
130
|
-
type: 'select',
|
|
131
|
-
select: {
|
|
132
|
-
options: [
|
|
133
|
-
{ name: 'critical', color: 'red' },
|
|
134
|
-
{ name: 'high', color: 'orange' },
|
|
135
|
-
{ name: 'medium', color: 'yellow' },
|
|
136
|
-
{ name: 'low', color: 'gray' },
|
|
137
|
-
],
|
|
138
|
-
},
|
|
139
|
-
},
|
|
140
|
-
Type: {
|
|
141
|
-
type: 'select',
|
|
142
|
-
select: {
|
|
143
|
-
options: [
|
|
144
|
-
{ name: 'feature', color: 'blue' },
|
|
145
|
-
{ name: 'bug', color: 'red' },
|
|
146
|
-
{ name: 'improvement', color: 'green' },
|
|
147
|
-
{ name: 'chore', color: 'gray' },
|
|
148
|
-
],
|
|
149
|
-
},
|
|
150
|
-
},
|
|
151
|
-
Section: {
|
|
152
|
-
type: 'select',
|
|
153
|
-
select: {
|
|
154
|
-
options: [
|
|
155
|
-
{ name: 'active', color: 'blue' },
|
|
156
|
-
{ name: 'backlog', color: 'gray' },
|
|
157
|
-
],
|
|
158
|
-
},
|
|
159
|
-
},
|
|
160
|
-
Completed: { type: 'checkbox', checkbox: {} },
|
|
161
|
-
Agent: { type: 'rich_text', rich_text: {} },
|
|
162
|
-
Feature: { type: 'rich_text', rich_text: {} },
|
|
163
|
-
Created: { type: 'date', date: {} },
|
|
164
|
-
'Completed At': { type: 'date', date: {} },
|
|
165
|
-
},
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
// =============================================================================
|
|
169
|
-
// Dashboard Template
|
|
170
|
-
// =============================================================================
|
|
171
|
-
|
|
172
|
-
export interface DashboardMetrics {
|
|
173
|
-
shippedCount: number
|
|
174
|
-
ideasPending: number
|
|
175
|
-
tasksActive: number
|
|
176
|
-
roadmapProgress: number // 0-100
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
/**
|
|
180
|
-
* Dashboard page content template with metrics
|
|
181
|
-
*/
|
|
182
|
-
export function getDashboardContent(
|
|
183
|
-
projectName: string,
|
|
184
|
-
databases: {
|
|
185
|
-
shipped?: string
|
|
186
|
-
roadmap?: string
|
|
187
|
-
ideas?: string
|
|
188
|
-
tasks?: string
|
|
189
|
-
},
|
|
190
|
-
metrics?: DashboardMetrics
|
|
191
|
-
): string {
|
|
192
|
-
const sections: string[] = []
|
|
193
|
-
|
|
194
|
-
sections.push(`# ${projectName} Dashboard`)
|
|
195
|
-
sections.push('')
|
|
196
|
-
|
|
197
|
-
// Metrics section
|
|
198
|
-
if (metrics) {
|
|
199
|
-
sections.push('## Metrics')
|
|
200
|
-
sections.push('')
|
|
201
|
-
sections.push('| Metric | Value |')
|
|
202
|
-
sections.push('|--------|-------|')
|
|
203
|
-
sections.push(`| Features Shipped | ${metrics.shippedCount} |`)
|
|
204
|
-
sections.push(`| Ideas Pending | ${metrics.ideasPending} |`)
|
|
205
|
-
sections.push(`| Active Tasks | ${metrics.tasksActive} |`)
|
|
206
|
-
sections.push(`| Roadmap Progress | ${metrics.roadmapProgress}% |`)
|
|
207
|
-
sections.push('')
|
|
208
|
-
} else {
|
|
209
|
-
sections.push('*Metrics will appear after first sync*')
|
|
210
|
-
sections.push('')
|
|
211
|
-
}
|
|
212
|
-
|
|
213
|
-
// Database links
|
|
214
|
-
sections.push('## Databases')
|
|
215
|
-
sections.push('')
|
|
216
|
-
|
|
217
|
-
if (databases.shipped) {
|
|
218
|
-
sections.push(`- **Shipped Features**: Track released features and metrics`)
|
|
219
|
-
}
|
|
220
|
-
if (databases.roadmap) {
|
|
221
|
-
sections.push(`- **Roadmap**: Feature planning and progress`)
|
|
222
|
-
}
|
|
223
|
-
if (databases.ideas) {
|
|
224
|
-
sections.push(`- **Ideas**: Captured ideas and status`)
|
|
225
|
-
}
|
|
226
|
-
if (databases.tasks) {
|
|
227
|
-
sections.push(`- **Active Tasks**: Current task queue`)
|
|
228
|
-
}
|
|
229
|
-
|
|
230
|
-
sections.push('')
|
|
231
|
-
sections.push('---')
|
|
232
|
-
sections.push('Synced by [prjct-cli](https://prjct.app)')
|
|
233
|
-
|
|
234
|
-
return sections.join('\n')
|
|
235
|
-
}
|
|
236
|
-
|
|
237
|
-
// =============================================================================
|
|
238
|
-
// All Schemas Export
|
|
239
|
-
// =============================================================================
|
|
240
|
-
|
|
241
|
-
export const ALL_DATABASE_SCHEMAS = {
|
|
242
|
-
shipped: SHIPPED_DATABASE_SCHEMA,
|
|
243
|
-
roadmap: ROADMAP_DATABASE_SCHEMA,
|
|
244
|
-
ideas: IDEAS_DATABASE_SCHEMA,
|
|
245
|
-
tasks: TASKS_DATABASE_SCHEMA,
|
|
246
|
-
} as const
|
|
@@ -1,178 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Notion Plugin for prjct-cli
|
|
3
|
-
*
|
|
4
|
-
* Syncs prjct data to Notion databases on events.
|
|
5
|
-
* Activated when project has integrations.notion.enabled = true
|
|
6
|
-
*
|
|
7
|
-
* @version 1.0.0
|
|
8
|
-
*
|
|
9
|
-
* Configuration in GlobalConfig.integrations.notion:
|
|
10
|
-
* {
|
|
11
|
-
* "enabled": true,
|
|
12
|
-
* "databases": {
|
|
13
|
-
* "shipped": "notion-db-id",
|
|
14
|
-
* "ideas": "notion-db-id"
|
|
15
|
-
* },
|
|
16
|
-
* "syncOn": { "ship": true, "idea": true }
|
|
17
|
-
* }
|
|
18
|
-
*/
|
|
19
|
-
|
|
20
|
-
import { HookPoints } from '../hooks'
|
|
21
|
-
import type { NotionIntegrationConfig } from '../../types/integrations'
|
|
22
|
-
import type { ShippedFeature, Idea } from '../../types/storage'
|
|
23
|
-
import { notionClient, syncShippedFeature, syncIdea } from '../../integrations/notion'
|
|
24
|
-
|
|
25
|
-
interface NotionPluginContext {
|
|
26
|
-
projectId: string
|
|
27
|
-
config: NotionIntegrationConfig
|
|
28
|
-
apiToken?: string
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
const plugin = {
|
|
32
|
-
name: 'notion',
|
|
33
|
-
version: '1.0.0',
|
|
34
|
-
description: 'Sync prjct data to Notion',
|
|
35
|
-
|
|
36
|
-
// Plugin state
|
|
37
|
-
enabled: false,
|
|
38
|
-
projectId: null as string | null,
|
|
39
|
-
config: null as NotionIntegrationConfig | null,
|
|
40
|
-
|
|
41
|
-
/**
|
|
42
|
-
* Activate plugin
|
|
43
|
-
*/
|
|
44
|
-
async activate(context: NotionPluginContext): Promise<void> {
|
|
45
|
-
const { projectId, config, apiToken } = context
|
|
46
|
-
|
|
47
|
-
if (!config?.enabled) {
|
|
48
|
-
return
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
// Initialize Notion client
|
|
52
|
-
notionClient.initialize(config, apiToken || process.env.NOTION_TOKEN)
|
|
53
|
-
|
|
54
|
-
if (!notionClient.isReady()) {
|
|
55
|
-
console.warn('[notion] API token not configured, plugin disabled')
|
|
56
|
-
return
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
plugin.enabled = true
|
|
60
|
-
plugin.projectId = projectId
|
|
61
|
-
plugin.config = config
|
|
62
|
-
},
|
|
63
|
-
|
|
64
|
-
/**
|
|
65
|
-
* Deactivate plugin
|
|
66
|
-
*/
|
|
67
|
-
async deactivate(): Promise<void> {
|
|
68
|
-
plugin.enabled = false
|
|
69
|
-
plugin.projectId = null
|
|
70
|
-
plugin.config = null
|
|
71
|
-
},
|
|
72
|
-
|
|
73
|
-
/**
|
|
74
|
-
* Hook handlers
|
|
75
|
-
*/
|
|
76
|
-
hooks: {
|
|
77
|
-
/**
|
|
78
|
-
* Sync shipped feature to Notion after ship
|
|
79
|
-
*/
|
|
80
|
-
[HookPoints.AFTER_FEATURE_SHIP]: async function (data: {
|
|
81
|
-
feature: ShippedFeature
|
|
82
|
-
projectId?: string
|
|
83
|
-
}): Promise<void> {
|
|
84
|
-
if (!plugin.enabled || !plugin.config || !plugin.projectId) return
|
|
85
|
-
if (!plugin.config.syncOn?.ship) return
|
|
86
|
-
|
|
87
|
-
try {
|
|
88
|
-
const result = await syncShippedFeature(
|
|
89
|
-
data.projectId || plugin.projectId,
|
|
90
|
-
data.feature,
|
|
91
|
-
plugin.config
|
|
92
|
-
)
|
|
93
|
-
|
|
94
|
-
if (result.success) {
|
|
95
|
-
console.log(`[notion] Synced: ${data.feature.name} (${result.action})`)
|
|
96
|
-
} else if (result.error) {
|
|
97
|
-
console.warn(`[notion] Sync failed: ${result.error}`)
|
|
98
|
-
}
|
|
99
|
-
} catch (error) {
|
|
100
|
-
// Graceful degradation - don't fail the ship
|
|
101
|
-
console.warn('[notion] Sync error:', (error as Error).message)
|
|
102
|
-
}
|
|
103
|
-
},
|
|
104
|
-
|
|
105
|
-
/**
|
|
106
|
-
* Sync idea to Notion after capture
|
|
107
|
-
*/
|
|
108
|
-
[HookPoints.AFTER_IDEA_CAPTURE]: async function (data: {
|
|
109
|
-
idea: Idea
|
|
110
|
-
projectId?: string
|
|
111
|
-
}): Promise<void> {
|
|
112
|
-
if (!plugin.enabled || !plugin.config || !plugin.projectId) return
|
|
113
|
-
if (!plugin.config.syncOn?.idea) return
|
|
114
|
-
|
|
115
|
-
try {
|
|
116
|
-
const result = await syncIdea(
|
|
117
|
-
data.projectId || plugin.projectId,
|
|
118
|
-
data.idea,
|
|
119
|
-
plugin.config
|
|
120
|
-
)
|
|
121
|
-
|
|
122
|
-
if (result.success) {
|
|
123
|
-
console.log(`[notion] Synced idea: ${data.idea.text.slice(0, 30)}... (${result.action})`)
|
|
124
|
-
} else if (result.error) {
|
|
125
|
-
console.warn(`[notion] Sync failed: ${result.error}`)
|
|
126
|
-
}
|
|
127
|
-
} catch (error) {
|
|
128
|
-
// Graceful degradation - don't fail the idea capture
|
|
129
|
-
console.warn('[notion] Sync error:', (error as Error).message)
|
|
130
|
-
}
|
|
131
|
-
},
|
|
132
|
-
|
|
133
|
-
/**
|
|
134
|
-
* Sync task completion (optional)
|
|
135
|
-
*/
|
|
136
|
-
[HookPoints.AFTER_TASK_COMPLETE]: async function (data: {
|
|
137
|
-
taskName?: string
|
|
138
|
-
projectId?: string
|
|
139
|
-
}): Promise<void> {
|
|
140
|
-
if (!plugin.enabled || !plugin.config || !plugin.projectId) return
|
|
141
|
-
if (!plugin.config.syncOn?.done) return
|
|
142
|
-
|
|
143
|
-
// Task sync is optional and less critical
|
|
144
|
-
// Could update task status in Notion if database exists
|
|
145
|
-
if (data.taskName) {
|
|
146
|
-
console.log(`[notion] Task completed: ${data.taskName}`)
|
|
147
|
-
}
|
|
148
|
-
},
|
|
149
|
-
},
|
|
150
|
-
|
|
151
|
-
/**
|
|
152
|
-
* Check if plugin is active
|
|
153
|
-
*/
|
|
154
|
-
isActive(): boolean {
|
|
155
|
-
return plugin.enabled && plugin.config?.enabled === true
|
|
156
|
-
},
|
|
157
|
-
|
|
158
|
-
/**
|
|
159
|
-
* Get current sync status
|
|
160
|
-
*/
|
|
161
|
-
getStatus(): {
|
|
162
|
-
enabled: boolean
|
|
163
|
-
databases: number
|
|
164
|
-
lastSync?: string
|
|
165
|
-
} {
|
|
166
|
-
const dbCount = plugin.config?.databases
|
|
167
|
-
? Object.values(plugin.config.databases).filter(Boolean).length
|
|
168
|
-
: 0
|
|
169
|
-
|
|
170
|
-
return {
|
|
171
|
-
enabled: plugin.enabled,
|
|
172
|
-
databases: dbCount,
|
|
173
|
-
lastSync: plugin.config?.lastSyncAt,
|
|
174
|
-
}
|
|
175
|
-
},
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
export default plugin
|