@cluesmith/codev 1.6.1 → 2.0.0-rc.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/bin/porch.js +7 -0
- package/dist/agent-farm/cli.d.ts.map +1 -1
- package/dist/agent-farm/cli.js +23 -0
- package/dist/agent-farm/cli.js.map +1 -1
- package/dist/agent-farm/commands/index.d.ts +1 -0
- package/dist/agent-farm/commands/index.d.ts.map +1 -1
- package/dist/agent-farm/commands/index.js +1 -0
- package/dist/agent-farm/commands/index.js.map +1 -1
- package/dist/agent-farm/commands/kickoff.d.ts +19 -0
- package/dist/agent-farm/commands/kickoff.d.ts.map +1 -0
- package/dist/agent-farm/commands/kickoff.js +269 -0
- package/dist/agent-farm/commands/kickoff.js.map +1 -0
- package/dist/agent-farm/commands/spawn.d.ts.map +1 -1
- package/dist/agent-farm/commands/spawn.js +17 -3
- package/dist/agent-farm/commands/spawn.js.map +1 -1
- package/dist/agent-farm/commands/start.d.ts.map +1 -1
- package/dist/agent-farm/commands/start.js +8 -0
- package/dist/agent-farm/commands/start.js.map +1 -1
- package/dist/agent-farm/hq-connector.d.ts +23 -0
- package/dist/agent-farm/hq-connector.d.ts.map +1 -0
- package/dist/agent-farm/hq-connector.js +366 -0
- package/dist/agent-farm/hq-connector.js.map +1 -0
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +29 -0
- package/dist/cli.js.map +1 -1
- package/dist/commands/pcheck/cache.d.ts +48 -0
- package/dist/commands/pcheck/cache.d.ts.map +1 -0
- package/dist/commands/pcheck/cache.js +170 -0
- package/dist/commands/pcheck/cache.js.map +1 -0
- package/dist/commands/pcheck/evaluator.d.ts +15 -0
- package/dist/commands/pcheck/evaluator.d.ts.map +1 -0
- package/dist/commands/pcheck/evaluator.js +246 -0
- package/dist/commands/pcheck/evaluator.js.map +1 -0
- package/dist/commands/pcheck/index.d.ts +12 -0
- package/dist/commands/pcheck/index.d.ts.map +1 -0
- package/dist/commands/pcheck/index.js +249 -0
- package/dist/commands/pcheck/index.js.map +1 -0
- package/dist/commands/pcheck/parser.d.ts +39 -0
- package/dist/commands/pcheck/parser.d.ts.map +1 -0
- package/dist/commands/pcheck/parser.js +155 -0
- package/dist/commands/pcheck/parser.js.map +1 -0
- package/dist/commands/pcheck/types.d.ts +82 -0
- package/dist/commands/pcheck/types.d.ts.map +1 -0
- package/dist/commands/pcheck/types.js +5 -0
- package/dist/commands/pcheck/types.js.map +1 -0
- package/dist/commands/porch/checks.d.ts +42 -0
- package/dist/commands/porch/checks.d.ts.map +1 -0
- package/dist/commands/porch/checks.js +195 -0
- package/dist/commands/porch/checks.js.map +1 -0
- package/dist/commands/porch/consultation.d.ts +56 -0
- package/dist/commands/porch/consultation.d.ts.map +1 -0
- package/dist/commands/porch/consultation.js +330 -0
- package/dist/commands/porch/consultation.js.map +1 -0
- package/dist/commands/porch/index.d.ts +60 -0
- package/dist/commands/porch/index.d.ts.map +1 -0
- package/dist/commands/porch/index.js +828 -0
- package/dist/commands/porch/index.js.map +1 -0
- package/dist/commands/porch/notifications.d.ts +99 -0
- package/dist/commands/porch/notifications.d.ts.map +1 -0
- package/dist/commands/porch/notifications.js +223 -0
- package/dist/commands/porch/notifications.js.map +1 -0
- package/dist/commands/porch/plan-parser.d.ts +38 -0
- package/dist/commands/porch/plan-parser.d.ts.map +1 -0
- package/dist/commands/porch/plan-parser.js +166 -0
- package/dist/commands/porch/plan-parser.js.map +1 -0
- package/dist/commands/porch/protocol-loader.d.ts +46 -0
- package/dist/commands/porch/protocol-loader.d.ts.map +1 -0
- package/dist/commands/porch/protocol-loader.js +249 -0
- package/dist/commands/porch/protocol-loader.js.map +1 -0
- package/dist/commands/porch/signal-parser.d.ts +88 -0
- package/dist/commands/porch/signal-parser.d.ts.map +1 -0
- package/dist/commands/porch/signal-parser.js +148 -0
- package/dist/commands/porch/signal-parser.js.map +1 -0
- package/dist/commands/porch/state.d.ts +133 -0
- package/dist/commands/porch/state.d.ts.map +1 -0
- package/dist/commands/porch/state.js +760 -0
- package/dist/commands/porch/state.js.map +1 -0
- package/dist/commands/porch/types.d.ts +232 -0
- package/dist/commands/porch/types.d.ts.map +1 -0
- package/dist/commands/porch/types.js +7 -0
- package/dist/commands/porch/types.js.map +1 -0
- package/package.json +6 -2
- package/skeleton/porch/prompts/defend.md +103 -0
- package/skeleton/porch/prompts/diagnose.md +70 -0
- package/skeleton/porch/prompts/evaluate.md +132 -0
- package/skeleton/porch/prompts/fix.md +59 -0
- package/skeleton/porch/prompts/implement.md +79 -0
- package/skeleton/porch/prompts/plan.md +74 -0
- package/skeleton/porch/prompts/pr.md +84 -0
- package/skeleton/porch/prompts/review.md +179 -0
- package/skeleton/porch/prompts/specify.md +53 -0
- package/skeleton/porch/prompts/test.md +63 -0
- package/skeleton/porch/prompts/understand.md +61 -0
- package/skeleton/porch/prompts/verify.md +58 -0
- package/skeleton/porch/protocols/bugfix.json +85 -0
- package/skeleton/porch/protocols/spider.json +135 -0
- package/skeleton/porch/protocols/tick.json +76 -0
- package/skeleton/protocols/bugfix/protocol.json +127 -0
- package/skeleton/protocols/protocol-schema.json +237 -0
- package/skeleton/protocols/spider/protocol.json +204 -0
- package/skeleton/protocols/tick/protocol.json +151 -0
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Porch State Management
|
|
3
|
+
*
|
|
4
|
+
* Handles project state persistence with:
|
|
5
|
+
* - Pure YAML format (no markdown frontmatter)
|
|
6
|
+
* - Atomic writes (tmp file + fsync + rename)
|
|
7
|
+
* - File locking (flock advisory locking)
|
|
8
|
+
* - Crash recovery
|
|
9
|
+
*/
|
|
10
|
+
import type { ProjectState, Protocol } from './types.js';
|
|
11
|
+
/** Directory for SPIDER project state (relative to project root) */
|
|
12
|
+
export declare const PROJECTS_DIR = "codev/projects";
|
|
13
|
+
/** Directory for TICK/BUGFIX execution state (relative to project root) */
|
|
14
|
+
export declare const EXECUTIONS_DIR = "codev/executions";
|
|
15
|
+
/**
|
|
16
|
+
* Get the status file path for a SPIDER project
|
|
17
|
+
*/
|
|
18
|
+
export declare function getProjectStatusPath(projectRoot: string, projectId: string, name?: string): string;
|
|
19
|
+
/**
|
|
20
|
+
* Get the status file path for a TICK/BUGFIX execution
|
|
21
|
+
*/
|
|
22
|
+
export declare function getExecutionStatusPath(projectRoot: string, protocol: string, id: string, name?: string): string;
|
|
23
|
+
/**
|
|
24
|
+
* Get the project directory for a SPIDER project
|
|
25
|
+
*/
|
|
26
|
+
export declare function getProjectDir(projectRoot: string, projectId: string, name?: string): string;
|
|
27
|
+
/**
|
|
28
|
+
* Get the worktree path for a protocol execution
|
|
29
|
+
*/
|
|
30
|
+
export declare function getWorktreePath(projectRoot: string, protocol: string, id: string, name?: string): string;
|
|
31
|
+
interface FileLock {
|
|
32
|
+
fd: number;
|
|
33
|
+
lockFile: string;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Acquire an advisory lock on a file
|
|
37
|
+
* Creates a .lock file to indicate lock ownership
|
|
38
|
+
*/
|
|
39
|
+
export declare function acquireLock(filePath: string): Promise<FileLock>;
|
|
40
|
+
/**
|
|
41
|
+
* Release an advisory lock
|
|
42
|
+
*/
|
|
43
|
+
export declare function releaseLock(lock: FileLock): void;
|
|
44
|
+
/**
|
|
45
|
+
* Simple YAML serializer for project state
|
|
46
|
+
* Handles our specific data structures without external dependencies
|
|
47
|
+
*/
|
|
48
|
+
export declare function serializeState(state: ProjectState): string;
|
|
49
|
+
/**
|
|
50
|
+
* Parse YAML status file into ProjectState
|
|
51
|
+
*/
|
|
52
|
+
export declare function parseState(content: string): ProjectState;
|
|
53
|
+
/**
|
|
54
|
+
* Read project state from status file
|
|
55
|
+
*/
|
|
56
|
+
export declare function readState(statusFilePath: string): ProjectState | null;
|
|
57
|
+
/**
|
|
58
|
+
* Write project state atomically
|
|
59
|
+
* Uses tmp file + fsync + rename for crash safety
|
|
60
|
+
*/
|
|
61
|
+
export declare function writeState(statusFilePath: string, state: ProjectState): Promise<void>;
|
|
62
|
+
/**
|
|
63
|
+
* Create initial project state
|
|
64
|
+
*/
|
|
65
|
+
export declare function createInitialState(protocol: Protocol, projectId: string, title: string, worktreePath?: string): ProjectState;
|
|
66
|
+
/**
|
|
67
|
+
* Update state with a new current state
|
|
68
|
+
*/
|
|
69
|
+
export declare function updateState(state: ProjectState, newState: string, options?: {
|
|
70
|
+
signal?: string;
|
|
71
|
+
}): ProjectState;
|
|
72
|
+
/**
|
|
73
|
+
* Approve a gate in state
|
|
74
|
+
*/
|
|
75
|
+
export declare function approveGate(state: ProjectState, gateId: string): ProjectState;
|
|
76
|
+
/**
|
|
77
|
+
* Request a gate approval (mark as pending with timestamp)
|
|
78
|
+
*/
|
|
79
|
+
export declare function requestGateApproval(state: ProjectState, gateId: string): ProjectState;
|
|
80
|
+
/**
|
|
81
|
+
* Update phase status
|
|
82
|
+
*/
|
|
83
|
+
export declare function updatePhaseStatus(state: ProjectState, phaseId: string, status: 'pending' | 'in_progress' | 'complete'): ProjectState;
|
|
84
|
+
/**
|
|
85
|
+
* Set plan phases extracted from plan.md
|
|
86
|
+
*/
|
|
87
|
+
export declare function setPlanPhases(state: ProjectState, phases: Array<{
|
|
88
|
+
id: string;
|
|
89
|
+
title: string;
|
|
90
|
+
description?: string;
|
|
91
|
+
}>): ProjectState;
|
|
92
|
+
/**
|
|
93
|
+
* Find all SPIDER projects
|
|
94
|
+
*/
|
|
95
|
+
export declare function findProjects(projectRoot: string): Array<{
|
|
96
|
+
id: string;
|
|
97
|
+
path: string;
|
|
98
|
+
}>;
|
|
99
|
+
/**
|
|
100
|
+
* Find all executions (TICK, BUGFIX, etc.)
|
|
101
|
+
*/
|
|
102
|
+
export declare function findExecutions(projectRoot: string): Array<{
|
|
103
|
+
protocol: string;
|
|
104
|
+
id: string;
|
|
105
|
+
path: string;
|
|
106
|
+
}>;
|
|
107
|
+
/**
|
|
108
|
+
* Find status file for a project by ID
|
|
109
|
+
*/
|
|
110
|
+
export declare function findStatusFile(projectRoot: string, projectId: string): string | null;
|
|
111
|
+
/**
|
|
112
|
+
* Get the number of consultation attempts for a given state
|
|
113
|
+
*/
|
|
114
|
+
export declare function getConsultationAttempts(state: ProjectState, stateKey: string): number;
|
|
115
|
+
/**
|
|
116
|
+
* Increment consultation attempts for a given state
|
|
117
|
+
*/
|
|
118
|
+
export declare function incrementConsultationAttempts(state: ProjectState, stateKey: string): ProjectState;
|
|
119
|
+
/**
|
|
120
|
+
* Reset consultation attempts for a given state (e.g., after gate approval)
|
|
121
|
+
*/
|
|
122
|
+
export declare function resetConsultationAttempts(state: ProjectState, stateKey: string): ProjectState;
|
|
123
|
+
/**
|
|
124
|
+
* Find all status files with pending gates
|
|
125
|
+
*/
|
|
126
|
+
export declare function findPendingGates(projectRoot: string): Array<{
|
|
127
|
+
projectId: string;
|
|
128
|
+
gateId: string;
|
|
129
|
+
requestedAt?: string;
|
|
130
|
+
statusPath: string;
|
|
131
|
+
}>;
|
|
132
|
+
export {};
|
|
133
|
+
//# sourceMappingURL=state.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"state.d.ts","sourceRoot":"","sources":["../../../src/commands/porch/state.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAKH,OAAO,KAAK,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAMzD,oEAAoE;AACpE,eAAO,MAAM,YAAY,mBAAmB,CAAC;AAE7C,2EAA2E;AAC3E,eAAO,MAAM,cAAc,qBAAqB,CAAC;AAYjD;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,WAAW,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,CAKlG;AAED;;GAEG;AACH,wBAAgB,sBAAsB,CACpC,WAAW,EAAE,MAAM,EACnB,QAAQ,EAAE,MAAM,EAChB,EAAE,EAAE,MAAM,EACV,IAAI,CAAC,EAAE,MAAM,GACZ,MAAM,CA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