prjct-cli 0.20.0 → 0.20.1
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 +24 -6
- package/CLAUDE.md +56 -15
- package/README.md +5 -6
- package/bin/prjct +59 -42
- package/bin/prjct.ts +60 -0
- package/core/__tests__/agentic/memory-system.test.ts +18 -3
- package/core/__tests__/agentic/plan-mode.test.ts +55 -26
- package/core/__tests__/agentic/prompt-builder.test.ts +6 -6
- package/core/__tests__/utils/project-commands.test.ts +72 -0
- package/core/agentic/agent-router.ts +3 -12
- package/core/agentic/command-executor.ts +372 -3
- package/core/agentic/context-builder.ts +7 -27
- package/core/agentic/ground-truth.ts +604 -5
- package/core/agentic/index.ts +180 -0
- package/core/agentic/loop-detector.ts +418 -4
- package/core/agentic/memory-system.ts +857 -3
- package/core/agentic/plan-mode.ts +491 -4
- package/core/agentic/prompt-builder.ts +44 -65
- package/core/agentic/services.ts +13 -5
- package/core/agentic/skill-loader.ts +112 -0
- package/core/agentic/smart-context.ts +37 -122
- package/core/agentic/template-loader.ts +79 -122
- package/core/agentic/tool-registry.ts +5 -11
- package/core/agents/index.ts +1 -1
- package/core/agents/performance.ts +4 -2
- package/core/bus/bus.ts +262 -0
- package/core/bus/index.ts +3 -313
- package/core/commands/analysis.ts +5 -5
- package/core/commands/analytics.ts +11 -11
- package/core/commands/base.ts +33 -209
- package/core/commands/cleanup.ts +148 -0
- package/core/commands/command-data.ts +346 -0
- package/core/commands/commands.ts +216 -0
- package/core/commands/design.ts +83 -0
- package/core/commands/index.ts +13 -207
- package/core/commands/maintenance.ts +52 -473
- package/core/commands/planning.ts +3 -3
- package/core/commands/register.ts +104 -0
- package/core/commands/registry.ts +441 -0
- package/core/commands/setup.ts +25 -9
- package/core/commands/shipping.ts +48 -11
- package/core/commands/snapshots.ts +299 -0
- package/core/commands/workflow.ts +2 -2
- package/core/constants/index.ts +254 -4
- package/core/domain/agent-loader.ts +5 -6
- package/core/domain/task-stack.ts +555 -4
- package/core/errors.ts +127 -1
- package/core/events/events.ts +87 -0
- package/core/events/index.ts +4 -138
- package/core/index.ts +15 -23
- package/core/infrastructure/agent-detector.ts +126 -201
- package/core/infrastructure/author-detector.ts +99 -171
- package/core/infrastructure/command-installer.ts +476 -4
- package/core/infrastructure/config-manager.ts +41 -37
- package/core/infrastructure/path-manager.ts +59 -9
- package/core/infrastructure/permission-manager.ts +286 -0
- package/core/outcomes/analyzer.ts +7 -41
- package/core/outcomes/index.ts +1 -1
- package/core/outcomes/recorder.ts +1 -1
- package/core/{plugins → plugin/builtin}/webhook.ts +6 -22
- package/core/plugin/loader.ts +5 -5
- package/core/plugin/registry.ts +2 -2
- package/core/schemas/ideas.ts +85 -54
- package/core/schemas/index.ts +14 -33
- package/core/schemas/permissions.ts +177 -0
- package/core/schemas/project.ts +39 -12
- package/core/schemas/roadmap.ts +94 -59
- package/core/schemas/schemas.ts +39 -0
- package/core/schemas/shipped.ts +87 -60
- package/core/schemas/state.ts +110 -70
- package/core/server/index.ts +21 -0
- package/core/server/routes.ts +165 -0
- package/core/server/server.ts +136 -0
- package/core/server/sse.ts +135 -0
- package/core/services/agent-service.ts +170 -0
- package/core/services/breakdown-service.ts +126 -0
- package/core/services/index.ts +21 -0
- package/core/services/memory-service.ts +108 -0
- package/core/services/project-service.ts +146 -0
- package/core/services/skill-service.ts +253 -0
- package/core/session/compaction.ts +257 -0
- package/core/session/index.ts +20 -8
- package/core/{infrastructure/session-manager/migration.ts → session/log-migration.ts} +9 -9
- package/core/{infrastructure/session-manager/session-manager.ts → session/session-log-manager.ts} +27 -26
- package/core/session/{session-manager.ts → task-session-manager.ts} +7 -4
- package/core/session/utils.ts +1 -1
- package/core/storage/ideas-storage.ts +10 -26
- package/core/storage/index.ts +14 -162
- package/core/storage/queue-storage.ts +13 -11
- package/core/storage/shipped-storage.ts +4 -17
- package/core/storage/state-storage.ts +35 -43
- package/core/storage/storage-manager.ts +42 -52
- package/core/storage/storage.ts +160 -0
- package/core/sync/auth-config.ts +1 -8
- package/core/sync/index.ts +17 -10
- package/core/sync/oauth-handler.ts +1 -6
- package/core/sync/sync-client.ts +6 -34
- package/core/sync/sync-manager.ts +11 -40
- package/core/types/agentic.ts +577 -0
- package/core/types/agents.ts +145 -0
- package/core/types/bus.ts +82 -0
- package/core/types/commands.ts +366 -0
- package/core/types/config.ts +66 -0
- package/core/types/core.ts +96 -0
- package/core/types/domain.ts +71 -0
- package/core/types/events.ts +42 -0
- package/core/types/fs.ts +56 -0
- package/core/types/index.ts +387 -500
- package/core/types/infrastructure.ts +196 -0
- package/core/{agentic/memory-system/types.ts → types/memory.ts} +33 -8
- package/core/{outcomes/types.ts → types/outcomes.ts} +53 -8
- package/core/types/plugin.ts +25 -0
- package/core/types/server.ts +54 -0
- package/core/types/services.ts +65 -0
- package/core/types/session.ts +135 -0
- package/core/types/storage.ts +148 -0
- package/core/types/sync.ts +121 -0
- package/core/types/task.ts +72 -0
- package/core/types/template.ts +24 -0
- package/core/types/utils.ts +90 -0
- package/core/utils/cache.ts +195 -0
- package/core/utils/collection-filters.ts +245 -0
- package/core/utils/date-helper.ts +1 -5
- package/core/utils/file-helper.ts +20 -10
- package/core/utils/jsonl-helper.ts +5 -8
- package/core/utils/markdown-builder.ts +277 -0
- package/core/utils/project-commands.ts +132 -0
- package/core/utils/runtime.ts +119 -0
- package/dist/bin/prjct.mjs +12568 -0
- package/package.json +13 -8
- package/scripts/build.js +106 -0
- package/scripts/postinstall.js +50 -8
- package/templates/agentic/subagent-generation.md +1 -1
- package/templates/commands/serve.md +118 -0
- package/templates/commands/ship.md +13 -2
- package/templates/commands/skill.md +110 -0
- package/templates/commands/sync.md +1 -1
- package/templates/commands/test.md +23 -4
- package/templates/permissions/default.jsonc +60 -0
- package/templates/permissions/permissive.jsonc +49 -0
- package/templates/permissions/strict.jsonc +62 -0
- package/templates/skills/code-review.md +47 -0
- package/templates/skills/debug.md +61 -0
- package/templates/skills/refactor.md +47 -0
- package/templates/subagents/domain/devops.md +1 -1
- package/templates/subagents/domain/testing.md +6 -10
- package/templates/subagents/workflow/prjct-shipper.md +16 -7
- package/templates/tools/bash.txt +22 -0
- package/templates/tools/edit.txt +18 -0
- package/templates/tools/glob.txt +19 -0
- package/templates/tools/grep.txt +21 -0
- package/templates/tools/read.txt +14 -0
- package/templates/tools/task.txt +20 -0
- package/templates/tools/webfetch.txt +16 -0
- package/templates/tools/websearch.txt +18 -0
- package/templates/tools/write.txt +17 -0
- package/core/agentic/command-executor/command-executor.ts +0 -312
- package/core/agentic/command-executor/index.ts +0 -16
- package/core/agentic/command-executor/status-signal.ts +0 -38
- package/core/agentic/command-executor/types.ts +0 -79
- package/core/agentic/ground-truth/index.ts +0 -76
- package/core/agentic/ground-truth/types.ts +0 -33
- package/core/agentic/ground-truth/utils.ts +0 -48
- package/core/agentic/ground-truth/verifiers/analyze.ts +0 -54
- package/core/agentic/ground-truth/verifiers/done.ts +0 -75
- package/core/agentic/ground-truth/verifiers/feature.ts +0 -70
- package/core/agentic/ground-truth/verifiers/index.ts +0 -37
- package/core/agentic/ground-truth/verifiers/init.ts +0 -52
- package/core/agentic/ground-truth/verifiers/now.ts +0 -57
- package/core/agentic/ground-truth/verifiers/ship.ts +0 -85
- package/core/agentic/ground-truth/verifiers/spec.ts +0 -45
- package/core/agentic/ground-truth/verifiers/sync.ts +0 -47
- package/core/agentic/ground-truth/verifiers.ts +0 -6
- package/core/agentic/loop-detector/error-analysis.ts +0 -97
- package/core/agentic/loop-detector/hallucination.ts +0 -71
- package/core/agentic/loop-detector/index.ts +0 -41
- package/core/agentic/loop-detector/loop-detector.ts +0 -222
- package/core/agentic/loop-detector/types.ts +0 -66
- package/core/agentic/memory-system/history.ts +0 -53
- package/core/agentic/memory-system/index.ts +0 -192
- package/core/agentic/memory-system/patterns.ts +0 -156
- package/core/agentic/memory-system/semantic-memories.ts +0 -278
- package/core/agentic/memory-system/session.ts +0 -21
- package/core/agentic/plan-mode/approval.ts +0 -57
- package/core/agentic/plan-mode/constants.ts +0 -44
- package/core/agentic/plan-mode/index.ts +0 -28
- package/core/agentic/plan-mode/plan-mode.ts +0 -407
- package/core/agentic/plan-mode/types.ts +0 -193
- package/core/agents/types.ts +0 -126
- package/core/command-registry/categories.ts +0 -23
- package/core/command-registry/commands.ts +0 -15
- package/core/command-registry/core-commands.ts +0 -344
- package/core/command-registry/index.ts +0 -158
- package/core/command-registry/optional-commands.ts +0 -163
- package/core/command-registry/setup-commands.ts +0 -83
- package/core/command-registry/types.ts +0 -59
- package/core/command-registry.ts +0 -9
- package/core/commands/types.ts +0 -185
- package/core/commands.ts +0 -11
- package/core/constants/formats.ts +0 -187
- package/core/context-sync.ts +0 -18
- package/core/data/index.ts +0 -27
- package/core/data/md-base-manager.ts +0 -203
- package/core/data/md-ideas-manager.ts +0 -155
- package/core/data/md-queue-manager.ts +0 -180
- package/core/data/md-shipped-manager.ts +0 -90
- package/core/data/md-state-manager.ts +0 -137
- package/core/domain/task-stack/index.ts +0 -19
- package/core/domain/task-stack/parser.ts +0 -86
- package/core/domain/task-stack/storage.ts +0 -123
- package/core/domain/task-stack/task-stack.ts +0 -340
- package/core/domain/task-stack/types.ts +0 -51
- package/core/infrastructure/command-installer/command-installer.ts +0 -327
- package/core/infrastructure/command-installer/global-config.ts +0 -136
- package/core/infrastructure/command-installer/index.ts +0 -25
- package/core/infrastructure/command-installer/types.ts +0 -41
- package/core/infrastructure/session-manager/index.ts +0 -23
- package/core/infrastructure/session-manager/types.ts +0 -45
- package/core/infrastructure/session-manager.ts +0 -8
- package/core/serializers/ideas-serializer.ts +0 -187
- package/core/serializers/index.ts +0 -36
- package/core/serializers/queue-serializer.ts +0 -210
- package/core/serializers/shipped-serializer.ts +0 -108
- package/core/serializers/state-serializer.ts +0 -136
- package/core/session/types.ts +0 -29
- /package/core/infrastructure/{agents/claude-agent.ts → claude-agent.ts} +0 -0
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Event Bus Types
|
|
3
|
+
* Types for the lightweight Pub/Sub system.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
// =============================================================================
|
|
7
|
+
// Event Types Constant
|
|
8
|
+
// =============================================================================
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Event Types - All events that can be emitted
|
|
12
|
+
*/
|
|
13
|
+
export const EventTypes = {
|
|
14
|
+
// Session events
|
|
15
|
+
SESSION_STARTED: 'session.started',
|
|
16
|
+
SESSION_PAUSED: 'session.paused',
|
|
17
|
+
SESSION_RESUMED: 'session.resumed',
|
|
18
|
+
SESSION_COMPLETED: 'session.completed',
|
|
19
|
+
|
|
20
|
+
// Task events
|
|
21
|
+
TASK_CREATED: 'task.created',
|
|
22
|
+
TASK_COMPLETED: 'task.completed',
|
|
23
|
+
TASK_UPDATED: 'task.updated',
|
|
24
|
+
|
|
25
|
+
// Feature events
|
|
26
|
+
FEATURE_ADDED: 'feature.added',
|
|
27
|
+
FEATURE_SHIPPED: 'feature.shipped',
|
|
28
|
+
FEATURE_UPDATED: 'feature.updated',
|
|
29
|
+
|
|
30
|
+
// Idea events
|
|
31
|
+
IDEA_CAPTURED: 'idea.captured',
|
|
32
|
+
IDEA_PROMOTED: 'idea.promoted',
|
|
33
|
+
|
|
34
|
+
// Snapshot events
|
|
35
|
+
SNAPSHOT_CREATED: 'snapshot.created',
|
|
36
|
+
SNAPSHOT_RESTORED: 'snapshot.restored',
|
|
37
|
+
|
|
38
|
+
// Git events
|
|
39
|
+
COMMIT_CREATED: 'git.commit',
|
|
40
|
+
PUSH_COMPLETED: 'git.push',
|
|
41
|
+
|
|
42
|
+
// System events
|
|
43
|
+
PROJECT_INITIALIZED: 'project.init',
|
|
44
|
+
PROJECT_SYNCED: 'project.sync',
|
|
45
|
+
ANALYSIS_COMPLETED: 'analysis.completed',
|
|
46
|
+
|
|
47
|
+
// Wildcard
|
|
48
|
+
ALL: '*',
|
|
49
|
+
} as const
|
|
50
|
+
|
|
51
|
+
// =============================================================================
|
|
52
|
+
// Bus Types
|
|
53
|
+
// =============================================================================
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Event type union derived from EventTypes
|
|
57
|
+
*/
|
|
58
|
+
export type BusEventType = (typeof EventTypes)[keyof typeof EventTypes]
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Event data payload
|
|
62
|
+
*/
|
|
63
|
+
export interface EventData {
|
|
64
|
+
type: string
|
|
65
|
+
timestamp: string
|
|
66
|
+
projectId: string | null
|
|
67
|
+
[key: string]: unknown
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* Event callback handler
|
|
72
|
+
*/
|
|
73
|
+
export type EventCallback = (data: EventData) => void | Promise<void>
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* Event subscription
|
|
77
|
+
*/
|
|
78
|
+
export interface EventSubscription {
|
|
79
|
+
id: string
|
|
80
|
+
type: BusEventType
|
|
81
|
+
callback: EventCallback
|
|
82
|
+
}
|
|
@@ -0,0 +1,366 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Command Types
|
|
3
|
+
* Types for the command system.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
// ============================================
|
|
7
|
+
// Core Command Types
|
|
8
|
+
// ============================================
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Command execution result with optional extra data.
|
|
12
|
+
* This is the EXTENDED version with command-specific fields.
|
|
13
|
+
*/
|
|
14
|
+
export interface CommandResult {
|
|
15
|
+
success: boolean
|
|
16
|
+
message?: string
|
|
17
|
+
error?: string
|
|
18
|
+
/** Duration of command execution */
|
|
19
|
+
duration?: string
|
|
20
|
+
/** Task that was affected */
|
|
21
|
+
task?: string
|
|
22
|
+
/** Feature that was affected */
|
|
23
|
+
feature?: string
|
|
24
|
+
/** Files that were modified */
|
|
25
|
+
filesModified?: string[]
|
|
26
|
+
/** Allow any additional properties for command-specific data */
|
|
27
|
+
[key: string]: unknown
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Command usage - which interfaces support this command
|
|
32
|
+
*/
|
|
33
|
+
export interface CommandUsage {
|
|
34
|
+
human: string
|
|
35
|
+
claude: string
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Command metadata for requirements and categorization
|
|
40
|
+
*/
|
|
41
|
+
export interface CommandMetadata {
|
|
42
|
+
requiresProject: boolean
|
|
43
|
+
requiresActiveTask: boolean
|
|
44
|
+
modifiesState: boolean
|
|
45
|
+
category: string
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Feature status for a command
|
|
50
|
+
*/
|
|
51
|
+
export interface CommandFeature {
|
|
52
|
+
name: string
|
|
53
|
+
status: 'implemented' | 'planned' | 'deprecated'
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Command definition
|
|
58
|
+
*/
|
|
59
|
+
export interface Command {
|
|
60
|
+
name: string
|
|
61
|
+
description: string
|
|
62
|
+
category: string
|
|
63
|
+
usage: CommandUsage
|
|
64
|
+
metadata: CommandMetadata
|
|
65
|
+
features: CommandFeature[]
|
|
66
|
+
implemented: boolean
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* Command registry interface
|
|
71
|
+
*/
|
|
72
|
+
export interface CommandRegistry {
|
|
73
|
+
getByName(name: string): Command | undefined
|
|
74
|
+
getByCategory(category: string): Command[]
|
|
75
|
+
getAll(): Command[]
|
|
76
|
+
getStats(): CommandStats
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* Command statistics
|
|
81
|
+
*/
|
|
82
|
+
export interface CommandStats {
|
|
83
|
+
total: number
|
|
84
|
+
implemented: number
|
|
85
|
+
planned: number
|
|
86
|
+
byCategory: Record<string, number>
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
// ============================================
|
|
90
|
+
// Command Options Types
|
|
91
|
+
// ============================================
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* Author information
|
|
95
|
+
*/
|
|
96
|
+
export interface Author {
|
|
97
|
+
name?: string
|
|
98
|
+
email?: string
|
|
99
|
+
github?: string
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* Options for the design command.
|
|
104
|
+
*/
|
|
105
|
+
export interface DesignOptions {
|
|
106
|
+
/** Type of design */
|
|
107
|
+
type?: 'architecture' | 'api' | 'component' | 'database' | 'flow'
|
|
108
|
+
/** Output format */
|
|
109
|
+
format?: 'markdown' | 'mermaid'
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
* Options for the cleanup command.
|
|
114
|
+
*/
|
|
115
|
+
export interface CleanupOptions {
|
|
116
|
+
/** Clean up memory/history */
|
|
117
|
+
memory?: boolean
|
|
118
|
+
/** Type of cleanup */
|
|
119
|
+
type?: 'all' | 'memory' | 'sessions' | 'cache'
|
|
120
|
+
/** Dry run without making changes */
|
|
121
|
+
dryRun?: boolean
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
* Options for the setup command.
|
|
126
|
+
*/
|
|
127
|
+
export interface SetupOptions {
|
|
128
|
+
/** Force re-setup even if already configured */
|
|
129
|
+
force?: boolean
|
|
130
|
+
/** Skip interactive prompts */
|
|
131
|
+
nonInteractive?: boolean
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
/**
|
|
135
|
+
* Options for the migrate-all command.
|
|
136
|
+
*/
|
|
137
|
+
export interface MigrateOptions {
|
|
138
|
+
/** Perform deep scan for legacy installations */
|
|
139
|
+
deepScan?: boolean
|
|
140
|
+
/** Remove legacy installations after migration */
|
|
141
|
+
removeLegacy?: boolean
|
|
142
|
+
/** Dry run without making changes */
|
|
143
|
+
dryRun?: boolean
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
/**
|
|
147
|
+
* Options for the analyze command.
|
|
148
|
+
*/
|
|
149
|
+
export interface AnalyzeOptions {
|
|
150
|
+
/** Force re-analysis even if cached */
|
|
151
|
+
force?: boolean
|
|
152
|
+
/** Analysis depth */
|
|
153
|
+
depth?: 'quick' | 'normal' | 'deep'
|
|
154
|
+
/** Allow additional options */
|
|
155
|
+
[key: string]: unknown
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
// ============================================
|
|
159
|
+
// Migration Types
|
|
160
|
+
// ============================================
|
|
161
|
+
|
|
162
|
+
/**
|
|
163
|
+
* Result from project migration.
|
|
164
|
+
*/
|
|
165
|
+
export interface MigrationResult {
|
|
166
|
+
success: boolean
|
|
167
|
+
projectId: string | null
|
|
168
|
+
filesCopied?: number
|
|
169
|
+
layerCounts: LayerCounts
|
|
170
|
+
config: MigrationConfig | null
|
|
171
|
+
author: Author | null
|
|
172
|
+
issues: string[]
|
|
173
|
+
dryRun: boolean
|
|
174
|
+
legacyRemoved?: boolean
|
|
175
|
+
legacyCleaned?: boolean
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
/**
|
|
179
|
+
* Layer counts for migration
|
|
180
|
+
*/
|
|
181
|
+
export interface LayerCounts {
|
|
182
|
+
core: number
|
|
183
|
+
progress: number
|
|
184
|
+
planning: number
|
|
185
|
+
analysis: number
|
|
186
|
+
memory: number
|
|
187
|
+
other: number
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
/**
|
|
191
|
+
* Migration configuration
|
|
192
|
+
*/
|
|
193
|
+
export interface MigrationConfig {
|
|
194
|
+
projectId: string
|
|
195
|
+
version: string
|
|
196
|
+
migratedAt: string
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
// ============================================
|
|
200
|
+
// Analysis Types
|
|
201
|
+
// ============================================
|
|
202
|
+
|
|
203
|
+
/**
|
|
204
|
+
* Complexity analysis result
|
|
205
|
+
*/
|
|
206
|
+
export interface ComplexityResult {
|
|
207
|
+
level: 'low' | 'medium' | 'high'
|
|
208
|
+
hours: number
|
|
209
|
+
type: string
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
/**
|
|
213
|
+
* Health check result
|
|
214
|
+
*/
|
|
215
|
+
export interface HealthResult {
|
|
216
|
+
score: number
|
|
217
|
+
message: string
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
// ============================================
|
|
221
|
+
// Command Function Types
|
|
222
|
+
// ============================================
|
|
223
|
+
|
|
224
|
+
/**
|
|
225
|
+
* Type-safe command method names (for dynamic invocation)
|
|
226
|
+
*/
|
|
227
|
+
export type CommandMethodName =
|
|
228
|
+
| 'work' | 'now' | 'done' | 'next' | 'pause' | 'resume'
|
|
229
|
+
| 'init' | 'feature' | 'bug' | 'idea' | 'spec'
|
|
230
|
+
| 'ship'
|
|
231
|
+
| 'dash' | 'help'
|
|
232
|
+
| 'cleanup' | 'design' | 'recover' | 'undo' | 'redo' | 'history'
|
|
233
|
+
| 'analyze' | 'sync'
|
|
234
|
+
| 'start' | 'setup' | 'migrateAll'
|
|
235
|
+
|
|
236
|
+
/**
|
|
237
|
+
* Function signature for standard command methods
|
|
238
|
+
*/
|
|
239
|
+
export type StandardCommandFn = (param: string | null, projectPath?: string) => Promise<CommandResult>
|
|
240
|
+
|
|
241
|
+
// ============================================
|
|
242
|
+
// Registry Types
|
|
243
|
+
// ============================================
|
|
244
|
+
|
|
245
|
+
/**
|
|
246
|
+
* Execution context passed to all command handlers
|
|
247
|
+
*/
|
|
248
|
+
export interface ExecutionContext {
|
|
249
|
+
projectId: string
|
|
250
|
+
projectPath: string
|
|
251
|
+
globalPath: string
|
|
252
|
+
timestamp: string
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
/**
|
|
256
|
+
* Command handler interface - all commands implement this
|
|
257
|
+
*/
|
|
258
|
+
export interface CommandHandler<TParams = void, TResult = CommandResult> {
|
|
259
|
+
/** Command name for registration */
|
|
260
|
+
readonly name: string
|
|
261
|
+
/** Execute the command */
|
|
262
|
+
execute(params: TParams, context: ExecutionContext): Promise<TResult>
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
/**
|
|
266
|
+
* Handler function type for simple commands
|
|
267
|
+
*/
|
|
268
|
+
export type HandlerFn<TParams = void> = (
|
|
269
|
+
params: TParams,
|
|
270
|
+
context: ExecutionContext
|
|
271
|
+
) => Promise<CommandResult>
|
|
272
|
+
|
|
273
|
+
/**
|
|
274
|
+
* Registry command usage - which interfaces support this command
|
|
275
|
+
*/
|
|
276
|
+
export interface RegistryCommandUsage {
|
|
277
|
+
claude: string | null
|
|
278
|
+
terminal: string | null
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
/**
|
|
282
|
+
* Blocking rules for commands
|
|
283
|
+
*/
|
|
284
|
+
export interface BlockingRules {
|
|
285
|
+
check: string
|
|
286
|
+
message: string
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
/**
|
|
290
|
+
* Command metadata for introspection (registry version)
|
|
291
|
+
*/
|
|
292
|
+
export interface CommandMeta {
|
|
293
|
+
name: string
|
|
294
|
+
group: string
|
|
295
|
+
description: string
|
|
296
|
+
requiresProject: boolean
|
|
297
|
+
usage: RegistryCommandUsage
|
|
298
|
+
params?: string
|
|
299
|
+
implemented: boolean
|
|
300
|
+
hasTemplate: boolean
|
|
301
|
+
blockingRules?: BlockingRules
|
|
302
|
+
features?: string[]
|
|
303
|
+
isOptional?: boolean
|
|
304
|
+
deprecated?: boolean
|
|
305
|
+
replacedBy?: string
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
/**
|
|
309
|
+
* Category metadata
|
|
310
|
+
*/
|
|
311
|
+
export interface CategoryInfo {
|
|
312
|
+
title: string
|
|
313
|
+
description: string
|
|
314
|
+
order: number
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
/**
|
|
318
|
+
* Registry statistics
|
|
319
|
+
*/
|
|
320
|
+
export interface RegistryStats {
|
|
321
|
+
total: number
|
|
322
|
+
implemented: number
|
|
323
|
+
withTemplates: number
|
|
324
|
+
claudeOnly: number
|
|
325
|
+
terminalOnly: number
|
|
326
|
+
both: number
|
|
327
|
+
requiresInit: number
|
|
328
|
+
byCategory: Record<string, number>
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
/**
|
|
332
|
+
* Validation result
|
|
333
|
+
*/
|
|
334
|
+
export interface ValidationResult {
|
|
335
|
+
valid: boolean
|
|
336
|
+
issues: string[]
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
// Note: AgentInfo and AgentAssignmentResult moved to agents.ts
|
|
340
|
+
|
|
341
|
+
// ============================================
|
|
342
|
+
// Global Config Types (command-related)
|
|
343
|
+
// ============================================
|
|
344
|
+
|
|
345
|
+
/**
|
|
346
|
+
* Global configuration for prjct.
|
|
347
|
+
*/
|
|
348
|
+
export interface GlobalConfig {
|
|
349
|
+
projectId: string
|
|
350
|
+
projectPath?: string
|
|
351
|
+
authors: AuthorEntry[]
|
|
352
|
+
version: string
|
|
353
|
+
created?: string
|
|
354
|
+
lastSync: string
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
/**
|
|
358
|
+
* Author entry in global config
|
|
359
|
+
*/
|
|
360
|
+
export interface AuthorEntry {
|
|
361
|
+
name: string
|
|
362
|
+
email: string
|
|
363
|
+
github: string
|
|
364
|
+
firstContribution?: string
|
|
365
|
+
lastActivity?: string
|
|
366
|
+
}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Config Types
|
|
3
|
+
* Types for project and global configuration.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Local config - stored in .prjct/prjct.config.json
|
|
8
|
+
* Minimal config that points to global storage
|
|
9
|
+
*/
|
|
10
|
+
export interface LocalConfig {
|
|
11
|
+
projectId: string
|
|
12
|
+
dataPath: string
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Global config - stored in ~/.prjct-cli/projects/{id}/project.json
|
|
17
|
+
* Contains all project metadata
|
|
18
|
+
*/
|
|
19
|
+
export interface GlobalConfig {
|
|
20
|
+
projectId: string
|
|
21
|
+
projectPath?: string
|
|
22
|
+
authors: AuthorEntry[]
|
|
23
|
+
version: string
|
|
24
|
+
created?: string
|
|
25
|
+
lastSync: string
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Author entry in global config
|
|
30
|
+
*/
|
|
31
|
+
export interface AuthorEntry {
|
|
32
|
+
name: string
|
|
33
|
+
email: string
|
|
34
|
+
github: string
|
|
35
|
+
firstContribution?: string
|
|
36
|
+
lastActivity?: string
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Project config - generic project settings (for registry)
|
|
41
|
+
*/
|
|
42
|
+
export interface ProjectConfig {
|
|
43
|
+
projectId: string
|
|
44
|
+
name?: string
|
|
45
|
+
createdAt: string
|
|
46
|
+
updatedAt: string
|
|
47
|
+
settings?: ProjectSettings
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Project-specific settings
|
|
52
|
+
*/
|
|
53
|
+
export interface ProjectSettings {
|
|
54
|
+
autoCommit?: boolean
|
|
55
|
+
commitFooter?: string
|
|
56
|
+
branchNaming?: string
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* Global settings - user preferences
|
|
61
|
+
*/
|
|
62
|
+
export interface GlobalSettings {
|
|
63
|
+
defaultAuthor?: string
|
|
64
|
+
theme?: 'light' | 'dark'
|
|
65
|
+
telemetry?: boolean
|
|
66
|
+
}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Core Types
|
|
3
|
+
* Canonical definitions for project context and state.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
export interface ContextPaths {
|
|
7
|
+
now: string
|
|
8
|
+
next: string
|
|
9
|
+
context: string
|
|
10
|
+
shipped: string
|
|
11
|
+
metrics: string
|
|
12
|
+
ideas: string
|
|
13
|
+
roadmap: string
|
|
14
|
+
specs: string
|
|
15
|
+
memory: string
|
|
16
|
+
patterns: string
|
|
17
|
+
analysis: string
|
|
18
|
+
codePatterns: string
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Command parameters passed from CLI to commands.
|
|
23
|
+
* Each property corresponds to a CLI argument or flag.
|
|
24
|
+
*/
|
|
25
|
+
export interface CommandParams {
|
|
26
|
+
/** Task description for now/build commands */
|
|
27
|
+
task?: string
|
|
28
|
+
/** Feature/bug description */
|
|
29
|
+
description?: string
|
|
30
|
+
/** Feature name for feature/ship commands */
|
|
31
|
+
feature?: string
|
|
32
|
+
/** Idea text for idea command */
|
|
33
|
+
idea?: string
|
|
34
|
+
/** Alias for idea */
|
|
35
|
+
text?: string
|
|
36
|
+
/** Name parameter for various commands */
|
|
37
|
+
name?: string
|
|
38
|
+
/** Skip planning mode check */
|
|
39
|
+
skipPlanning?: boolean
|
|
40
|
+
/** User has approved destructive action */
|
|
41
|
+
approved?: boolean
|
|
42
|
+
/** Period for progress command */
|
|
43
|
+
period?: 'day' | 'week' | 'month'
|
|
44
|
+
/** Target for design command */
|
|
45
|
+
target?: string
|
|
46
|
+
/** Action for architect command */
|
|
47
|
+
action?: string
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Project context for Claude and command execution.
|
|
52
|
+
*/
|
|
53
|
+
export interface ProjectContext {
|
|
54
|
+
projectId: string
|
|
55
|
+
projectPath: string
|
|
56
|
+
globalPath: string
|
|
57
|
+
paths: ContextPaths
|
|
58
|
+
params: CommandParams
|
|
59
|
+
timestamp: string
|
|
60
|
+
date: string
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export interface ProjectState {
|
|
64
|
+
now: string | null
|
|
65
|
+
next: string | null
|
|
66
|
+
shipped: string | null
|
|
67
|
+
metrics: string | null
|
|
68
|
+
ideas: string | null
|
|
69
|
+
roadmap: string | null
|
|
70
|
+
analysis: string | null
|
|
71
|
+
codePatterns: string | null
|
|
72
|
+
_compressed?: Record<string, CompressedContent>
|
|
73
|
+
_compressionMetrics?: CompressionMetrics
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* Metrics from semantic compression of project state.
|
|
78
|
+
*/
|
|
79
|
+
export interface CompressionMetrics {
|
|
80
|
+
/** Original total size in bytes */
|
|
81
|
+
originalSize: number
|
|
82
|
+
/** Compressed total size in bytes */
|
|
83
|
+
compressedSize: number
|
|
84
|
+
/** Compression ratio (0-1) */
|
|
85
|
+
ratio: number
|
|
86
|
+
/** Fields that were compressed */
|
|
87
|
+
fieldsCompressed: string[]
|
|
88
|
+
/** Timestamp of compression */
|
|
89
|
+
timestamp: string
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
export interface CompressedContent {
|
|
93
|
+
raw: string
|
|
94
|
+
summary: string
|
|
95
|
+
compressed: string
|
|
96
|
+
}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Domain Types
|
|
3
|
+
* Types for domain layer modules.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
// =============================================================================
|
|
7
|
+
// Task Stack Types
|
|
8
|
+
// =============================================================================
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Task entry in the stack (JSONL format)
|
|
12
|
+
*/
|
|
13
|
+
export interface TaskStackEntry {
|
|
14
|
+
id: string
|
|
15
|
+
task: string
|
|
16
|
+
agent: string
|
|
17
|
+
status: 'active' | 'paused' | 'completed'
|
|
18
|
+
started: string
|
|
19
|
+
paused: string | null
|
|
20
|
+
resumed: string | null
|
|
21
|
+
completed: string | null
|
|
22
|
+
duration: number | null
|
|
23
|
+
durationFormatted?: string
|
|
24
|
+
complexity: string
|
|
25
|
+
dev: string
|
|
26
|
+
pauseReason?: string
|
|
27
|
+
pausedDuration?: number
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Parsed content from legacy now.md file
|
|
32
|
+
*/
|
|
33
|
+
export interface ParsedNowFile {
|
|
34
|
+
description: string
|
|
35
|
+
started: string | null
|
|
36
|
+
agent: string | null
|
|
37
|
+
complexity: string | null
|
|
38
|
+
dev: string | null
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Result of migrating from legacy now.md to stack
|
|
43
|
+
*/
|
|
44
|
+
export interface TaskStackMigrationResult {
|
|
45
|
+
migrated: boolean
|
|
46
|
+
hadTask?: boolean
|
|
47
|
+
task?: TaskStackEntry
|
|
48
|
+
error?: string
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Result of switching between tasks
|
|
53
|
+
*/
|
|
54
|
+
export interface TaskSwitchResult {
|
|
55
|
+
paused: TaskStackEntry | null
|
|
56
|
+
resumed?: TaskStackEntry
|
|
57
|
+
started?: TaskStackEntry
|
|
58
|
+
type: 'resumed' | 'started'
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* Summary of task stack state
|
|
63
|
+
*/
|
|
64
|
+
export interface TaskStackSummary {
|
|
65
|
+
active: TaskStackEntry | null
|
|
66
|
+
paused: TaskStackEntry[]
|
|
67
|
+
pausedCount: number
|
|
68
|
+
completed: TaskStackEntry[]
|
|
69
|
+
completedCount: number
|
|
70
|
+
totalTasks: number
|
|
71
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Event Types
|
|
3
|
+
* Types for the event system and sync events.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
// =============================================================================
|
|
7
|
+
// Sync Event Types
|
|
8
|
+
// =============================================================================
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Event for synchronization with backend
|
|
12
|
+
*/
|
|
13
|
+
export interface SyncEvent {
|
|
14
|
+
type: string
|
|
15
|
+
path: string[]
|
|
16
|
+
data: unknown
|
|
17
|
+
timestamp: string
|
|
18
|
+
projectId: string
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Event type union for sync events
|
|
23
|
+
*/
|
|
24
|
+
export type SyncEventType =
|
|
25
|
+
| 'task.created'
|
|
26
|
+
| 'task.updated'
|
|
27
|
+
| 'task.completed'
|
|
28
|
+
| 'task.deleted'
|
|
29
|
+
| 'feature.created'
|
|
30
|
+
| 'feature.updated'
|
|
31
|
+
| 'feature.shipped'
|
|
32
|
+
| 'feature.deleted'
|
|
33
|
+
| 'idea.created'
|
|
34
|
+
| 'idea.updated'
|
|
35
|
+
| 'idea.deleted'
|
|
36
|
+
| 'session.started'
|
|
37
|
+
| 'session.completed'
|
|
38
|
+
| 'shipped.created'
|
|
39
|
+
| 'agent.created'
|
|
40
|
+
| 'agent.updated'
|
|
41
|
+
| 'agent.deleted'
|
|
42
|
+
| 'project.updated'
|