prjct-cli 1.6.7 → 1.6.9
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 +106 -5
- package/README.md +46 -0
- package/core/agentic/chain-of-thought.ts +3 -1
- package/core/agentic/ground-truth.ts +12 -5
- package/core/agentic/index.ts +14 -2
- package/core/agentic/memory-system.ts +86 -23
- package/core/agentic/services.ts +1 -1
- package/core/agentic/template-executor.ts +4 -4
- package/core/agentic/template-loader.ts +2 -8
- package/core/ai-tools/registry.ts +2 -9
- package/core/bus/bus.ts +0 -1
- package/core/bus/index.ts +1 -1
- package/core/cli/start.ts +0 -2
- package/core/commands/base.ts +2 -2
- package/core/commands/planning.ts +4 -6
- package/core/constants/index.ts +19 -0
- package/core/context/generator.ts +0 -2
- package/core/context-tools/files-tool.ts +0 -6
- package/core/context-tools/imports-tool.ts +0 -6
- package/core/context-tools/recent-tool.ts +0 -6
- package/core/context-tools/signatures-tool.ts +0 -6
- package/core/context-tools/summary-tool.ts +0 -6
- package/core/context-tools/token-counter.ts +0 -13
- package/core/infrastructure/agent-detector.ts +2 -15
- package/core/infrastructure/ai-provider.ts +0 -29
- package/core/infrastructure/author-detector.ts +0 -14
- package/core/infrastructure/config-manager.ts +1 -1
- package/core/infrastructure/path-manager.ts +3 -17
- package/core/infrastructure/setup.ts +0 -3
- package/core/integrations/jira/client.ts +3 -77
- package/core/plugin/hooks.ts +0 -2
- package/core/plugin/index.ts +0 -13
- package/core/plugin/loader.ts +0 -2
- package/core/plugin/registry.ts +0 -2
- package/core/server/server.ts +2 -4
- package/core/server/sse.ts +115 -59
- package/core/services/agent-service.ts +1 -1
- package/core/services/context-generator.ts +23 -48
- package/core/services/diff-generator.ts +18 -55
- package/core/services/hooks-service.ts +0 -1
- package/core/services/memory-service.ts +1 -1
- package/core/services/project-service.ts +1 -1
- package/core/services/stack-detector.ts +4 -20
- package/core/services/sync-service.ts +36 -107
- package/core/services/sync-verifier.ts +17 -37
- package/core/services/watch-service.ts +1 -1
- package/core/storage/index.ts +1 -1
- package/core/storage/storage.ts +0 -2
- package/core/types/citations.ts +22 -0
- package/core/types/commands.ts +10 -0
- package/core/types/diff.ts +41 -0
- package/core/types/errors.ts +111 -0
- package/core/types/index.ts +80 -0
- package/core/types/infrastructure.ts +14 -0
- package/core/types/jira.ts +51 -0
- package/core/types/logger.ts +17 -0
- package/core/types/output.ts +47 -0
- package/core/types/project-sync.ts +109 -0
- package/core/types/server.ts +28 -10
- package/core/types/services.ts +14 -0
- package/core/types/stack.ts +19 -0
- package/core/types/sync-verifier.ts +33 -0
- package/core/types/workflow.ts +23 -0
- package/core/utils/animations.ts +0 -18
- package/core/utils/cache.ts +0 -6
- package/core/utils/citations.ts +2 -16
- package/core/utils/collection-filters.ts +0 -24
- package/core/utils/date-helper.ts +0 -20
- package/core/utils/error-messages.ts +5 -139
- package/core/utils/file-helper.ts +0 -26
- package/core/utils/help.ts +0 -9
- package/core/utils/jsonl-helper.ts +0 -21
- package/core/utils/logger.ts +3 -11
- package/core/utils/markdown-builder.ts +0 -3
- package/core/utils/next-steps.ts +0 -2
- package/core/utils/output.ts +6 -45
- package/core/utils/runtime.ts +0 -11
- package/core/utils/session-helper.ts +0 -12
- package/core/utils/version.ts +0 -12
- package/core/workflow/workflow-preferences.ts +18 -31
- package/dist/bin/prjct.mjs +319 -351
- package/dist/core/infrastructure/command-installer.js +1 -26
- package/dist/core/infrastructure/setup.js +1 -28
- package/dist/core/utils/version.js +0 -11
- package/package.json +1 -1
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Diff Types
|
|
3
|
+
* Types for sync diff and preserved sections.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
export interface DiffSection {
|
|
7
|
+
name: string
|
|
8
|
+
type: 'added' | 'modified' | 'removed' | 'unchanged'
|
|
9
|
+
before?: string
|
|
10
|
+
after?: string
|
|
11
|
+
lineCount: number
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export interface PreservedInfo {
|
|
15
|
+
name: string
|
|
16
|
+
lineCount: number
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export interface SyncDiff {
|
|
20
|
+
hasChanges: boolean
|
|
21
|
+
added: DiffSection[]
|
|
22
|
+
modified: DiffSection[]
|
|
23
|
+
removed: DiffSection[]
|
|
24
|
+
preserved: PreservedInfo[]
|
|
25
|
+
tokensBefore: number
|
|
26
|
+
tokensAfter: number
|
|
27
|
+
tokenDelta: number
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export interface DiffOptions {
|
|
31
|
+
showFullDiff?: boolean
|
|
32
|
+
colorize?: boolean
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/** Parsed markdown section (header + content range) */
|
|
36
|
+
export interface ParsedMarkdownSection {
|
|
37
|
+
name: string
|
|
38
|
+
content: string
|
|
39
|
+
startLine: number
|
|
40
|
+
endLine: number
|
|
41
|
+
}
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Error Types and Catalog
|
|
3
|
+
* ErrorWithHint, ErrorCode, and ERRORS catalog.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
export interface ErrorWithHint {
|
|
7
|
+
message: string
|
|
8
|
+
hint?: string
|
|
9
|
+
file?: string
|
|
10
|
+
docs?: string
|
|
11
|
+
code?: string
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export const ERRORS = {
|
|
15
|
+
NO_PROJECT: {
|
|
16
|
+
message: 'No prjct project found in this directory',
|
|
17
|
+
hint: "Run 'prjct init' to set up a new project",
|
|
18
|
+
file: '.prjct/prjct.config.json',
|
|
19
|
+
},
|
|
20
|
+
NO_PROJECT_ID: {
|
|
21
|
+
message: 'Project ID not found',
|
|
22
|
+
hint: "Run 'prjct init' or check .prjct/prjct.config.json",
|
|
23
|
+
file: '.prjct/prjct.config.json',
|
|
24
|
+
},
|
|
25
|
+
CONFIG_NOT_FOUND: {
|
|
26
|
+
message: 'Configuration file not found',
|
|
27
|
+
hint: "Run 'prjct init' to create project configuration",
|
|
28
|
+
file: '.prjct/prjct.config.json',
|
|
29
|
+
},
|
|
30
|
+
CONFIG_INVALID: {
|
|
31
|
+
message: 'Invalid configuration file',
|
|
32
|
+
hint: 'Check JSON syntax or delete .prjct/ and run init again',
|
|
33
|
+
file: '.prjct/prjct.config.json',
|
|
34
|
+
},
|
|
35
|
+
GIT_NOT_FOUND: {
|
|
36
|
+
message: 'Git repository not detected',
|
|
37
|
+
hint: "Run 'git init' first, then 'prjct init'",
|
|
38
|
+
},
|
|
39
|
+
GIT_NO_COMMITS: {
|
|
40
|
+
message: 'No commits in repository',
|
|
41
|
+
hint: 'Make an initial commit before using prjct',
|
|
42
|
+
},
|
|
43
|
+
GIT_DIRTY: {
|
|
44
|
+
message: 'Working directory has uncommitted changes',
|
|
45
|
+
hint: "Commit or stash changes, or use '--force' to override",
|
|
46
|
+
},
|
|
47
|
+
GIT_ON_MAIN: {
|
|
48
|
+
message: 'Cannot ship from main/master branch',
|
|
49
|
+
hint: 'Create a feature branch first: git checkout -b feature/your-feature',
|
|
50
|
+
},
|
|
51
|
+
GIT_OPERATION_FAILED: {
|
|
52
|
+
message: 'Git operation failed',
|
|
53
|
+
hint: 'Check git status and resolve any conflicts',
|
|
54
|
+
},
|
|
55
|
+
GH_NOT_AUTHENTICATED: {
|
|
56
|
+
message: 'GitHub CLI not authenticated',
|
|
57
|
+
hint: "Run 'gh auth login' to authenticate",
|
|
58
|
+
docs: 'https://cli.github.com/manual/gh_auth_login',
|
|
59
|
+
},
|
|
60
|
+
LINEAR_NOT_CONFIGURED: {
|
|
61
|
+
message: 'Linear integration not configured',
|
|
62
|
+
hint: "Run 'p. linear setup' to configure Linear",
|
|
63
|
+
},
|
|
64
|
+
LINEAR_API_ERROR: {
|
|
65
|
+
message: 'Linear API error',
|
|
66
|
+
hint: 'Check your API key or network connection',
|
|
67
|
+
},
|
|
68
|
+
NO_ACTIVE_TASK: {
|
|
69
|
+
message: 'No active task',
|
|
70
|
+
hint: 'Start a task with \'p. task "description"\'',
|
|
71
|
+
},
|
|
72
|
+
TASK_ALREADY_ACTIVE: {
|
|
73
|
+
message: 'A task is already in progress',
|
|
74
|
+
hint: "Complete it with 'p. done' or pause with 'p. pause'",
|
|
75
|
+
},
|
|
76
|
+
SYNC_FAILED: {
|
|
77
|
+
message: 'Project sync failed',
|
|
78
|
+
hint: 'Check file permissions and try again',
|
|
79
|
+
},
|
|
80
|
+
NOTHING_TO_SHIP: {
|
|
81
|
+
message: 'Nothing to ship',
|
|
82
|
+
hint: 'Make some changes first, then run ship',
|
|
83
|
+
},
|
|
84
|
+
PR_CREATE_FAILED: {
|
|
85
|
+
message: 'Failed to create pull request',
|
|
86
|
+
hint: 'Check GitHub auth and remote configuration',
|
|
87
|
+
},
|
|
88
|
+
NO_AI_PROVIDER: {
|
|
89
|
+
message: 'No AI provider detected',
|
|
90
|
+
hint: "Install Claude Code or Gemini CLI, then run 'prjct start'",
|
|
91
|
+
docs: 'https://prjct.app/docs',
|
|
92
|
+
},
|
|
93
|
+
PROVIDER_NOT_CONFIGURED: {
|
|
94
|
+
message: 'AI provider not configured for prjct',
|
|
95
|
+
hint: "Run 'prjct start' to configure your provider",
|
|
96
|
+
},
|
|
97
|
+
UNKNOWN_COMMAND: {
|
|
98
|
+
message: 'Unknown command',
|
|
99
|
+
hint: "Run 'prjct --help' to see available commands",
|
|
100
|
+
},
|
|
101
|
+
MISSING_PARAM: {
|
|
102
|
+
message: 'Missing required parameter',
|
|
103
|
+
hint: 'Check command usage below',
|
|
104
|
+
},
|
|
105
|
+
UNKNOWN: {
|
|
106
|
+
message: 'An unexpected error occurred',
|
|
107
|
+
hint: 'Check the error details and try again',
|
|
108
|
+
},
|
|
109
|
+
} as const
|
|
110
|
+
|
|
111
|
+
export type ErrorCode = keyof typeof ERRORS
|
package/core/types/index.ts
CHANGED
|
@@ -141,6 +141,10 @@ export type {
|
|
|
141
141
|
} from './bus'
|
|
142
142
|
export { EventTypes } from './bus'
|
|
143
143
|
// =============================================================================
|
|
144
|
+
// Citations Types
|
|
145
|
+
// =============================================================================
|
|
146
|
+
export type { ContextSources, SourceInfo, SourceType } from './citations'
|
|
147
|
+
// =============================================================================
|
|
144
148
|
// Command Types
|
|
145
149
|
// =============================================================================
|
|
146
150
|
export type {
|
|
@@ -172,6 +176,7 @@ export type {
|
|
|
172
176
|
GlobalConfig as CommandGlobalConfig,
|
|
173
177
|
HandlerFn,
|
|
174
178
|
HealthResult,
|
|
179
|
+
InitOptions,
|
|
175
180
|
LayerCounts,
|
|
176
181
|
MigrationConfig,
|
|
177
182
|
// Migration types
|
|
@@ -206,6 +211,16 @@ export type {
|
|
|
206
211
|
ProjectState,
|
|
207
212
|
} from './core'
|
|
208
213
|
// =============================================================================
|
|
214
|
+
// Diff Types
|
|
215
|
+
// =============================================================================
|
|
216
|
+
export type {
|
|
217
|
+
DiffOptions,
|
|
218
|
+
DiffSection,
|
|
219
|
+
ParsedMarkdownSection,
|
|
220
|
+
PreservedInfo,
|
|
221
|
+
SyncDiff,
|
|
222
|
+
} from './diff'
|
|
223
|
+
// =============================================================================
|
|
209
224
|
// Domain Types
|
|
210
225
|
// =============================================================================
|
|
211
226
|
export type {
|
|
@@ -216,6 +231,11 @@ export type {
|
|
|
216
231
|
TaskSwitchResult,
|
|
217
232
|
} from './domain'
|
|
218
233
|
// =============================================================================
|
|
234
|
+
// Error Types
|
|
235
|
+
// =============================================================================
|
|
236
|
+
export type { ErrorCode, ErrorWithHint } from './errors'
|
|
237
|
+
export { ERRORS } from './errors'
|
|
238
|
+
// =============================================================================
|
|
219
239
|
// Event Types
|
|
220
240
|
// =============================================================================
|
|
221
241
|
export type {
|
|
@@ -250,6 +270,8 @@ export type {
|
|
|
250
270
|
GlobalConfigResult,
|
|
251
271
|
InstallResult,
|
|
252
272
|
LayerType,
|
|
273
|
+
MonorepoInfo,
|
|
274
|
+
MonorepoPackage,
|
|
253
275
|
PathSessionInfo,
|
|
254
276
|
PermissionCheckResult,
|
|
255
277
|
PermissionLevel,
|
|
@@ -267,6 +289,19 @@ export type {
|
|
|
267
289
|
} from './integrations'
|
|
268
290
|
export { DEFAULT_JIRA_CONFIG, DEFAULT_LINEAR_CONFIG } from './integrations'
|
|
269
291
|
// =============================================================================
|
|
292
|
+
// JIRA Types
|
|
293
|
+
// =============================================================================
|
|
294
|
+
export type {
|
|
295
|
+
JiraAuthMode,
|
|
296
|
+
JiraIssue,
|
|
297
|
+
JiraProject,
|
|
298
|
+
JiraSearchResponse,
|
|
299
|
+
} from './jira'
|
|
300
|
+
// =============================================================================
|
|
301
|
+
// Logger Types
|
|
302
|
+
// =============================================================================
|
|
303
|
+
export type { LogFunction, Logger, LogLevel as LoggerLogLevel } from './logger'
|
|
304
|
+
// =============================================================================
|
|
270
305
|
// Memory Types
|
|
271
306
|
// =============================================================================
|
|
272
307
|
export type {
|
|
@@ -299,6 +334,10 @@ export type {
|
|
|
299
334
|
QualityScore,
|
|
300
335
|
} from './outcomes'
|
|
301
336
|
// =============================================================================
|
|
337
|
+
// Output Types
|
|
338
|
+
// =============================================================================
|
|
339
|
+
export type { Output, OutputMetrics, OutputTier, TierConfig } from './output'
|
|
340
|
+
// =============================================================================
|
|
302
341
|
// Plugin Types
|
|
303
342
|
// =============================================================================
|
|
304
343
|
export type {
|
|
@@ -307,6 +346,20 @@ export type {
|
|
|
307
346
|
WebhookPluginContext,
|
|
308
347
|
} from './plugin'
|
|
309
348
|
// =============================================================================
|
|
349
|
+
// Project Sync Types (sync-service / context-generator)
|
|
350
|
+
// =============================================================================
|
|
351
|
+
export type {
|
|
352
|
+
AIToolResult,
|
|
353
|
+
ContextGeneratorConfig,
|
|
354
|
+
GitData,
|
|
355
|
+
ProjectCommands,
|
|
356
|
+
ProjectStats,
|
|
357
|
+
ProjectSyncResult,
|
|
358
|
+
SyncAgentInfo,
|
|
359
|
+
SyncMetrics,
|
|
360
|
+
SyncOptions,
|
|
361
|
+
} from './project-sync'
|
|
362
|
+
// =============================================================================
|
|
310
363
|
// Provider Types (AI CLI abstraction)
|
|
311
364
|
// =============================================================================
|
|
312
365
|
export type {
|
|
@@ -322,15 +375,19 @@ export type {
|
|
|
322
375
|
// =============================================================================
|
|
323
376
|
export type {
|
|
324
377
|
ServerConfig,
|
|
378
|
+
ServerHandle,
|
|
325
379
|
ServerInstance,
|
|
326
380
|
SSEClient,
|
|
327
381
|
SSEEventType,
|
|
382
|
+
SSEInternalClient,
|
|
328
383
|
SSEManager,
|
|
329
384
|
} from './server'
|
|
385
|
+
export { SSE_EVENTS } from './server'
|
|
330
386
|
// =============================================================================
|
|
331
387
|
// Service Types
|
|
332
388
|
// =============================================================================
|
|
333
389
|
export type {
|
|
390
|
+
AIToolConfig,
|
|
334
391
|
ComplexityEstimate,
|
|
335
392
|
MemoryServiceEntry,
|
|
336
393
|
Severity,
|
|
@@ -355,6 +412,10 @@ export type {
|
|
|
355
412
|
TimelineEvent,
|
|
356
413
|
} from './session'
|
|
357
414
|
// =============================================================================
|
|
415
|
+
// Stack Types
|
|
416
|
+
// =============================================================================
|
|
417
|
+
export type { StackDetection, StackPackageJson } from './stack'
|
|
418
|
+
// =============================================================================
|
|
358
419
|
// Storage Types
|
|
359
420
|
// =============================================================================
|
|
360
421
|
export type {
|
|
@@ -393,6 +454,15 @@ export type {
|
|
|
393
454
|
SyncStatus,
|
|
394
455
|
} from './sync'
|
|
395
456
|
// =============================================================================
|
|
457
|
+
// Sync Verifier Types
|
|
458
|
+
// =============================================================================
|
|
459
|
+
export type {
|
|
460
|
+
VerificationCheck,
|
|
461
|
+
VerificationCheckResult,
|
|
462
|
+
VerificationConfig,
|
|
463
|
+
VerificationReport,
|
|
464
|
+
} from './sync-verifier'
|
|
465
|
+
// =============================================================================
|
|
396
466
|
// Task Types
|
|
397
467
|
// =============================================================================
|
|
398
468
|
export type {
|
|
@@ -425,3 +495,13 @@ export type {
|
|
|
425
495
|
MaybePromise,
|
|
426
496
|
Runtime,
|
|
427
497
|
} from './utils'
|
|
498
|
+
// =============================================================================
|
|
499
|
+
// Workflow Types
|
|
500
|
+
// =============================================================================
|
|
501
|
+
export type {
|
|
502
|
+
HookCommand,
|
|
503
|
+
HookPhase,
|
|
504
|
+
HookResult,
|
|
505
|
+
PreferenceScope,
|
|
506
|
+
WorkflowPreference,
|
|
507
|
+
} from './workflow'
|
|
@@ -7,6 +7,20 @@
|
|
|
7
7
|
// Path Management Types
|
|
8
8
|
// =============================================================================
|
|
9
9
|
|
|
10
|
+
export interface MonorepoPackage {
|
|
11
|
+
name: string
|
|
12
|
+
path: string
|
|
13
|
+
relativePath: string
|
|
14
|
+
hasPrjctMd: boolean
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export interface MonorepoInfo {
|
|
18
|
+
isMonorepo: boolean
|
|
19
|
+
type: 'pnpm' | 'npm' | 'yarn' | 'lerna' | 'nx' | 'rush' | 'turborepo' | null
|
|
20
|
+
rootPath: string
|
|
21
|
+
packages: MonorepoPackage[]
|
|
22
|
+
}
|
|
23
|
+
|
|
10
24
|
/**
|
|
11
25
|
* Session information for date-based paths
|
|
12
26
|
*/
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* JIRA Integration Types
|
|
3
|
+
* Types for JIRA API client.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
export interface JiraIssue {
|
|
7
|
+
id: string
|
|
8
|
+
key: string
|
|
9
|
+
self: string
|
|
10
|
+
fields: {
|
|
11
|
+
summary: string
|
|
12
|
+
description?:
|
|
13
|
+
| {
|
|
14
|
+
type: string
|
|
15
|
+
content: Array<{
|
|
16
|
+
type: string
|
|
17
|
+
content?: Array<{ type: string; text?: string }>[]
|
|
18
|
+
}>
|
|
19
|
+
}
|
|
20
|
+
| string
|
|
21
|
+
| null
|
|
22
|
+
status: {
|
|
23
|
+
id: string
|
|
24
|
+
name: string
|
|
25
|
+
statusCategory: { key: string; name: string }
|
|
26
|
+
}
|
|
27
|
+
priority?: { id: string; name: string }
|
|
28
|
+
issuetype: { id: string; name: string; subtask: boolean }
|
|
29
|
+
assignee?: { accountId: string; displayName: string; emailAddress?: string }
|
|
30
|
+
reporter?: { accountId: string; displayName: string; emailAddress?: string }
|
|
31
|
+
project: { id: string; key: string; name: string }
|
|
32
|
+
labels: string[]
|
|
33
|
+
created: string
|
|
34
|
+
updated: string
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export interface JiraSearchResponse {
|
|
39
|
+
issues: JiraIssue[]
|
|
40
|
+
total: number
|
|
41
|
+
maxResults: number
|
|
42
|
+
startAt: number
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export interface JiraProject {
|
|
46
|
+
id: string
|
|
47
|
+
key: string
|
|
48
|
+
name: string
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export type JiraAuthMode = 'api-token' | 'mcp' | 'none'
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Logger Types
|
|
3
|
+
* Types for centralized logging.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
export type LogLevel = 'error' | 'warn' | 'info' | 'debug'
|
|
7
|
+
|
|
8
|
+
export type LogFunction = (...args: unknown[]) => void
|
|
9
|
+
|
|
10
|
+
export interface Logger {
|
|
11
|
+
error: LogFunction
|
|
12
|
+
warn: LogFunction
|
|
13
|
+
info: LogFunction
|
|
14
|
+
debug: LogFunction
|
|
15
|
+
isEnabled: () => boolean
|
|
16
|
+
level: () => LogLevel | 'disabled'
|
|
17
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Output Types
|
|
3
|
+
* Types for CLI output, tiers, and metrics.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/** Error shape for failWithHint (matches ErrorWithHint from ./errors). */
|
|
7
|
+
export interface ErrorWithHintLike {
|
|
8
|
+
message: string
|
|
9
|
+
hint?: string
|
|
10
|
+
file?: string
|
|
11
|
+
docs?: string
|
|
12
|
+
code?: string
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export type OutputTier = 'silent' | 'minimal' | 'compact' | 'verbose'
|
|
16
|
+
|
|
17
|
+
export interface TierConfig {
|
|
18
|
+
maxLines: number
|
|
19
|
+
maxCharsPerLine: number
|
|
20
|
+
showMetrics: boolean
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export interface OutputMetrics {
|
|
24
|
+
agents?: number
|
|
25
|
+
reduction?: number
|
|
26
|
+
tokens?: number
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export interface Output {
|
|
30
|
+
start(): Output
|
|
31
|
+
end(): Output
|
|
32
|
+
spin(msg: string): Output
|
|
33
|
+
done(msg: string, metrics?: OutputMetrics): Output
|
|
34
|
+
fail(msg: string): Output
|
|
35
|
+
failWithHint(error: ErrorWithHintLike | string): Output
|
|
36
|
+
warn(msg: string): Output
|
|
37
|
+
info(msg: string): Output
|
|
38
|
+
debug(msg: string): Output
|
|
39
|
+
success(msg: string, metrics?: OutputMetrics): Output
|
|
40
|
+
list(items: string[], options?: { bullet?: string; indent?: number }): Output
|
|
41
|
+
table(rows: Array<Record<string, string | number>>, options?: { header?: boolean }): Output
|
|
42
|
+
box(title: string, content: string): Output
|
|
43
|
+
section(title: string): Output
|
|
44
|
+
stop(): Output
|
|
45
|
+
step(current: number, total: number, msg: string): Output
|
|
46
|
+
progress(current: number, total: number, msg?: string): Output
|
|
47
|
+
}
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Project Sync Types
|
|
3
|
+
*
|
|
4
|
+
* Shared types for sync-service and context-generator.
|
|
5
|
+
* Single source of truth for GitData, ProjectStats, ProjectCommands, SyncAgentInfo.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import type { SyncDiff } from './diff'
|
|
9
|
+
import type { StackDetection } from './stack'
|
|
10
|
+
import type { VerificationReport } from './sync-verifier'
|
|
11
|
+
|
|
12
|
+
// =============================================================================
|
|
13
|
+
// Git & Project Data
|
|
14
|
+
// =============================================================================
|
|
15
|
+
|
|
16
|
+
export interface GitData {
|
|
17
|
+
branch: string
|
|
18
|
+
commits: number
|
|
19
|
+
contributors: number
|
|
20
|
+
hasChanges: boolean
|
|
21
|
+
stagedFiles: string[]
|
|
22
|
+
modifiedFiles: string[]
|
|
23
|
+
untrackedFiles: string[]
|
|
24
|
+
recentCommits: { hash: string; message: string; date: string }[]
|
|
25
|
+
weeklyCommits: number
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export interface ProjectStats {
|
|
29
|
+
fileCount: number
|
|
30
|
+
version: string
|
|
31
|
+
name: string
|
|
32
|
+
ecosystem: string
|
|
33
|
+
projectType: string
|
|
34
|
+
languages: string[]
|
|
35
|
+
frameworks: string[]
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/** Project command strings (install, dev, test, etc.). Distinct from Command/CommandResult. */
|
|
39
|
+
export interface ProjectCommands {
|
|
40
|
+
install: string
|
|
41
|
+
run?: string
|
|
42
|
+
test: string
|
|
43
|
+
build: string
|
|
44
|
+
dev: string
|
|
45
|
+
lint: string
|
|
46
|
+
format: string
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/** Agent info as produced by sync/context (name, type, skill). Distinct from types/agents.AgentInfo. */
|
|
50
|
+
export interface SyncAgentInfo {
|
|
51
|
+
name: string
|
|
52
|
+
type: 'workflow' | 'domain'
|
|
53
|
+
skill?: string
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
// =============================================================================
|
|
57
|
+
// Sync Metrics & Options
|
|
58
|
+
// =============================================================================
|
|
59
|
+
|
|
60
|
+
export interface SyncMetrics {
|
|
61
|
+
duration: number
|
|
62
|
+
originalSize: number
|
|
63
|
+
filteredSize: number
|
|
64
|
+
compressionRate: number
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
export interface SyncOptions {
|
|
68
|
+
aiTools?: string[]
|
|
69
|
+
preview?: boolean
|
|
70
|
+
skipConfirmation?: boolean
|
|
71
|
+
packagePath?: string
|
|
72
|
+
packageName?: string
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
export interface AIToolResult {
|
|
76
|
+
toolId: string
|
|
77
|
+
outputFile: string
|
|
78
|
+
success: boolean
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
// =============================================================================
|
|
82
|
+
// Sync Result & Context Generator Config
|
|
83
|
+
// =============================================================================
|
|
84
|
+
|
|
85
|
+
export interface ProjectSyncResult {
|
|
86
|
+
success: boolean
|
|
87
|
+
projectId: string
|
|
88
|
+
cliVersion: string
|
|
89
|
+
git: GitData
|
|
90
|
+
stats: ProjectStats
|
|
91
|
+
commands: ProjectCommands
|
|
92
|
+
stack: StackDetection
|
|
93
|
+
agents: SyncAgentInfo[]
|
|
94
|
+
skills: { agent: string; skill: string }[]
|
|
95
|
+
skillsInstalled: { name: string; agent: string; status: 'installed' | 'skipped' | 'error' }[]
|
|
96
|
+
contextFiles: string[]
|
|
97
|
+
aiTools: AIToolResult[]
|
|
98
|
+
syncMetrics?: SyncMetrics
|
|
99
|
+
verification?: VerificationReport
|
|
100
|
+
error?: string
|
|
101
|
+
isPreview?: boolean
|
|
102
|
+
previewDiff?: SyncDiff
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
export interface ContextGeneratorConfig {
|
|
106
|
+
projectId: string
|
|
107
|
+
projectPath: string
|
|
108
|
+
globalPath: string
|
|
109
|
+
}
|
package/core/types/server.ts
CHANGED
|
@@ -9,6 +9,8 @@ import type { Context, Hono } from 'hono'
|
|
|
9
9
|
// Server Types
|
|
10
10
|
// =============================================================================
|
|
11
11
|
|
|
12
|
+
export type ServerHandle = { stop: () => void } | null
|
|
13
|
+
|
|
12
14
|
export interface ServerConfig {
|
|
13
15
|
port: number
|
|
14
16
|
host?: string
|
|
@@ -31,23 +33,39 @@ export interface ServerInstance {
|
|
|
31
33
|
|
|
32
34
|
export interface SSEClient {
|
|
33
35
|
id: string
|
|
36
|
+
connectedAt: string
|
|
34
37
|
send: (event: string, data: unknown) => void
|
|
35
38
|
close: () => void
|
|
36
39
|
}
|
|
37
40
|
|
|
41
|
+
export interface SSEInternalClient {
|
|
42
|
+
client: SSEClient
|
|
43
|
+
heartbeatInterval: ReturnType<typeof setInterval>
|
|
44
|
+
ttlTimeout: ReturnType<typeof setTimeout>
|
|
45
|
+
abortController: AbortController
|
|
46
|
+
}
|
|
47
|
+
|
|
38
48
|
export interface SSEManager {
|
|
39
49
|
handleConnection: (c: Context) => Response
|
|
40
50
|
broadcast: (event: string, data: unknown) => void
|
|
41
51
|
getClientCount: () => number
|
|
52
|
+
shutdown: () => void
|
|
42
53
|
}
|
|
43
54
|
|
|
44
|
-
export
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
55
|
+
export const SSE_EVENTS = {
|
|
56
|
+
TASK_STARTED: 'task:started',
|
|
57
|
+
TASK_COMPLETED: 'task:completed',
|
|
58
|
+
TASK_PAUSED: 'task:paused',
|
|
59
|
+
TASK_RESUMED: 'task:resumed',
|
|
60
|
+
FEATURE_CREATED: 'feature:created',
|
|
61
|
+
FEATURE_SHIPPED: 'feature:shipped',
|
|
62
|
+
IDEA_CAPTURED: 'idea:captured',
|
|
63
|
+
IDEA_CONVERTED: 'idea:converted',
|
|
64
|
+
STATE_UPDATED: 'state:updated',
|
|
65
|
+
QUEUE_UPDATED: 'queue:updated',
|
|
66
|
+
CONNECTED: 'connected',
|
|
67
|
+
HEARTBEAT: 'heartbeat',
|
|
68
|
+
ERROR: 'error',
|
|
69
|
+
} as const
|
|
70
|
+
|
|
71
|
+
export type SSEEventType = (typeof SSE_EVENTS)[keyof typeof SSE_EVENTS]
|
package/core/types/services.ts
CHANGED
|
@@ -54,6 +54,20 @@ export interface SkillSearchResult {
|
|
|
54
54
|
matchedTerms?: string[]
|
|
55
55
|
}
|
|
56
56
|
|
|
57
|
+
// =============================================================================
|
|
58
|
+
// AI Tools Registry Types
|
|
59
|
+
// =============================================================================
|
|
60
|
+
|
|
61
|
+
export interface AIToolConfig {
|
|
62
|
+
id: string
|
|
63
|
+
name: string
|
|
64
|
+
outputFile: string
|
|
65
|
+
outputPath: 'repo' | 'global'
|
|
66
|
+
maxTokens: number
|
|
67
|
+
format: 'detailed' | 'concise' | 'minimal' | 'json'
|
|
68
|
+
description: string
|
|
69
|
+
}
|
|
70
|
+
|
|
57
71
|
// =============================================================================
|
|
58
72
|
// Memory Service Types
|
|
59
73
|
// =============================================================================
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Stack Detection Types
|
|
3
|
+
* Types for project technology stack detection.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
export interface StackDetection {
|
|
7
|
+
hasFrontend: boolean
|
|
8
|
+
hasBackend: boolean
|
|
9
|
+
hasDatabase: boolean
|
|
10
|
+
hasDocker: boolean
|
|
11
|
+
hasTesting: boolean
|
|
12
|
+
frontendType: 'web' | 'mobile' | 'both' | null
|
|
13
|
+
frameworks: string[]
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export interface StackPackageJson {
|
|
17
|
+
dependencies?: Record<string, string>
|
|
18
|
+
devDependencies?: Record<string, string>
|
|
19
|
+
}
|