solveos-cli 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +194 -0
- package/agents/solveos-build-validator.md +183 -0
- package/agents/solveos-debugger.md +226 -0
- package/agents/solveos-executor.md +187 -0
- package/agents/solveos-plan-validator.md +200 -0
- package/agents/solveos-planner.md +190 -0
- package/agents/solveos-researcher.md +152 -0
- package/agents/solveos-reviewer.md +263 -0
- package/commands/solveos/archive.md +106 -0
- package/commands/solveos/build.md +170 -0
- package/commands/solveos/fast.md +85 -0
- package/commands/solveos/new-cycle.md +165 -0
- package/commands/solveos/new.md +142 -0
- package/commands/solveos/next.md +86 -0
- package/commands/solveos/plan.md +139 -0
- package/commands/solveos/quick.md +109 -0
- package/commands/solveos/research.md +117 -0
- package/commands/solveos/review.md +198 -0
- package/commands/solveos/ship.md +129 -0
- package/commands/solveos/status.md +78 -0
- package/commands/solveos/validate-build.md +155 -0
- package/commands/solveos/validate-plan.md +115 -0
- package/dist/bin/install.d.ts +11 -0
- package/dist/bin/install.d.ts.map +1 -0
- package/dist/bin/install.js +158 -0
- package/dist/bin/install.js.map +1 -0
- package/dist/hooks/brief-anchor.d.ts +68 -0
- package/dist/hooks/brief-anchor.d.ts.map +1 -0
- package/dist/hooks/brief-anchor.js +236 -0
- package/dist/hooks/brief-anchor.js.map +1 -0
- package/dist/hooks/context-monitor.d.ts +70 -0
- package/dist/hooks/context-monitor.d.ts.map +1 -0
- package/dist/hooks/context-monitor.js +166 -0
- package/dist/hooks/context-monitor.js.map +1 -0
- package/dist/lib/artifacts.d.ts +63 -0
- package/dist/lib/artifacts.d.ts.map +1 -0
- package/dist/lib/artifacts.js +382 -0
- package/dist/lib/artifacts.js.map +1 -0
- package/dist/lib/config.d.ts +10 -0
- package/dist/lib/config.d.ts.map +1 -0
- package/dist/lib/config.js +29 -0
- package/dist/lib/config.js.map +1 -0
- package/dist/lib/runtime-adapters/claude-code.d.ts +18 -0
- package/dist/lib/runtime-adapters/claude-code.d.ts.map +1 -0
- package/dist/lib/runtime-adapters/claude-code.js +125 -0
- package/dist/lib/runtime-adapters/claude-code.js.map +1 -0
- package/dist/lib/runtime-adapters/cursor.d.ts +18 -0
- package/dist/lib/runtime-adapters/cursor.d.ts.map +1 -0
- package/dist/lib/runtime-adapters/cursor.js +113 -0
- package/dist/lib/runtime-adapters/cursor.js.map +1 -0
- package/dist/lib/runtime-adapters/gemini-cli.d.ts +18 -0
- package/dist/lib/runtime-adapters/gemini-cli.d.ts.map +1 -0
- package/dist/lib/runtime-adapters/gemini-cli.js +127 -0
- package/dist/lib/runtime-adapters/gemini-cli.js.map +1 -0
- package/dist/lib/runtime-adapters/opencode.d.ts +14 -0
- package/dist/lib/runtime-adapters/opencode.d.ts.map +1 -0
- package/dist/lib/runtime-adapters/opencode.js +109 -0
- package/dist/lib/runtime-adapters/opencode.js.map +1 -0
- package/dist/lib/runtime-detect.d.ts +22 -0
- package/dist/lib/runtime-detect.d.ts.map +1 -0
- package/dist/lib/runtime-detect.js +73 -0
- package/dist/lib/runtime-detect.js.map +1 -0
- package/dist/lib/security.d.ts +88 -0
- package/dist/lib/security.d.ts.map +1 -0
- package/dist/lib/security.js +230 -0
- package/dist/lib/security.js.map +1 -0
- package/dist/types.d.ts +224 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +31 -0
- package/dist/types.js.map +1 -0
- package/dist/workflows/state-machine.d.ts +55 -0
- package/dist/workflows/state-machine.d.ts.map +1 -0
- package/dist/workflows/state-machine.js +271 -0
- package/dist/workflows/state-machine.js.map +1 -0
- package/dist/workflows/wave-executor.d.ts +112 -0
- package/dist/workflows/wave-executor.d.ts.map +1 -0
- package/dist/workflows/wave-executor.js +496 -0
- package/dist/workflows/wave-executor.js.map +1 -0
- package/package.json +58 -0
- package/templates/build-validation.md +82 -0
- package/templates/config-default.json +21 -0
- package/templates/plan-brief.md +106 -0
- package/templates/plan-validation-log.md +77 -0
- package/templates/post-ship-review.md +75 -0
- package/templates/pre-ship-review.md +56 -0
- package/templates/research-summary.md +30 -0
|
@@ -0,0 +1,230 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Security module for solveos-cli.
|
|
3
|
+
*
|
|
4
|
+
* Protects against:
|
|
5
|
+
* 1. Path traversal attacks — ensures all file operations stay within .solveos/
|
|
6
|
+
* 2. Prompt injection — scans user-supplied content for injection patterns
|
|
7
|
+
* before it's used as AI agent context
|
|
8
|
+
*
|
|
9
|
+
* Since solveos-cli generates markdown that becomes LLM system prompts,
|
|
10
|
+
* indirect prompt injection is a real attack surface.
|
|
11
|
+
*/
|
|
12
|
+
import { resolve, relative } from "node:path";
|
|
13
|
+
import { realpath } from "node:fs/promises";
|
|
14
|
+
// ---------------------------------------------------------------------------
|
|
15
|
+
// Path Validation
|
|
16
|
+
// ---------------------------------------------------------------------------
|
|
17
|
+
/**
|
|
18
|
+
* Validate that a target path resolves within a base directory.
|
|
19
|
+
* Prevents path traversal attacks (../../etc/passwd, symlinks, null bytes).
|
|
20
|
+
*
|
|
21
|
+
* @param basePath - The allowed root directory (e.g., /project/.solveos)
|
|
22
|
+
* @param targetPath - The path to validate (absolute or relative to basePath)
|
|
23
|
+
* @returns The resolved, validated absolute path
|
|
24
|
+
* @throws Error if the path escapes the base directory
|
|
25
|
+
*/
|
|
26
|
+
export function validatePath(basePath, targetPath) {
|
|
27
|
+
// Reject null bytes — used in null byte injection attacks
|
|
28
|
+
if (basePath.includes("\0") || targetPath.includes("\0")) {
|
|
29
|
+
throw new PathTraversalError("Null byte detected in path", targetPath, basePath);
|
|
30
|
+
}
|
|
31
|
+
const resolvedBase = resolve(basePath);
|
|
32
|
+
const resolvedTarget = resolve(resolvedBase, targetPath);
|
|
33
|
+
const rel = relative(resolvedBase, resolvedTarget);
|
|
34
|
+
// Check 1: relative path must not start with ".." (escaping base)
|
|
35
|
+
if (rel.startsWith("..")) {
|
|
36
|
+
throw new PathTraversalError(`Path resolves outside allowed directory`, targetPath, basePath);
|
|
37
|
+
}
|
|
38
|
+
// Check 2: empty relative path means target IS the base (allowed)
|
|
39
|
+
// Check 3: absolute paths that don't start with base are rejected
|
|
40
|
+
if (!resolvedTarget.startsWith(resolvedBase)) {
|
|
41
|
+
throw new PathTraversalError(`Path resolves outside allowed directory`, targetPath, basePath);
|
|
42
|
+
}
|
|
43
|
+
return resolvedTarget;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Validate path with symlink resolution.
|
|
47
|
+
* Resolves symlinks first, then validates the real path.
|
|
48
|
+
* Use this for operations where the target file already exists.
|
|
49
|
+
*
|
|
50
|
+
* @param basePath - The allowed root directory
|
|
51
|
+
* @param targetPath - The path to validate
|
|
52
|
+
* @returns The resolved, validated real path
|
|
53
|
+
* @throws Error if the real path escapes the base directory
|
|
54
|
+
*/
|
|
55
|
+
export async function validatePathWithSymlinks(basePath, targetPath) {
|
|
56
|
+
// First do the basic validation
|
|
57
|
+
const validated = validatePath(basePath, targetPath);
|
|
58
|
+
// Then resolve symlinks and re-validate
|
|
59
|
+
try {
|
|
60
|
+
const realBase = await realpath(basePath);
|
|
61
|
+
const realTarget = await realpath(validated);
|
|
62
|
+
const rel = relative(realBase, realTarget);
|
|
63
|
+
if (rel.startsWith("..") || !realTarget.startsWith(realBase)) {
|
|
64
|
+
throw new PathTraversalError(`Symlink resolves outside allowed directory`, targetPath, basePath);
|
|
65
|
+
}
|
|
66
|
+
return realTarget;
|
|
67
|
+
}
|
|
68
|
+
catch (err) {
|
|
69
|
+
// If realpath fails (file doesn't exist yet), the basic validation is sufficient
|
|
70
|
+
if (err.code === "ENOENT") {
|
|
71
|
+
return validated;
|
|
72
|
+
}
|
|
73
|
+
throw err;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Custom error for path traversal attempts.
|
|
78
|
+
*/
|
|
79
|
+
export class PathTraversalError extends Error {
|
|
80
|
+
attemptedPath;
|
|
81
|
+
basePath;
|
|
82
|
+
constructor(message, attemptedPath, basePath) {
|
|
83
|
+
super(`Path traversal detected: ${message} (attempted: "${attemptedPath}", base: "${basePath}")`);
|
|
84
|
+
this.name = "PathTraversalError";
|
|
85
|
+
this.attemptedPath = attemptedPath;
|
|
86
|
+
this.basePath = basePath;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Patterns that indicate prompt injection attempts.
|
|
91
|
+
* Ordered from most to least suspicious.
|
|
92
|
+
*/
|
|
93
|
+
const INJECTION_PATTERNS = [
|
|
94
|
+
// BLOCK-level: almost certainly injection attempts
|
|
95
|
+
{
|
|
96
|
+
name: "System prompt override",
|
|
97
|
+
regex: /ignore\s+(all\s+)?(previous|prior|above|earlier)\s+(instructions?|prompts?|rules?|directions?)/i,
|
|
98
|
+
severity: "block",
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
name: "System prompt reset",
|
|
102
|
+
regex: /forget\s+(all\s+)?(previous|prior|above|earlier)\s+(instructions?|context|conversation)/i,
|
|
103
|
+
severity: "block",
|
|
104
|
+
},
|
|
105
|
+
{
|
|
106
|
+
name: "Role switching",
|
|
107
|
+
regex: /you\s+are\s+now\s+(a|an|the)\s+(?!solveos)/i,
|
|
108
|
+
severity: "block",
|
|
109
|
+
},
|
|
110
|
+
{
|
|
111
|
+
name: "New system prompt injection",
|
|
112
|
+
regex: /\[?\s*system\s*\]?\s*:?\s*you\s+are/i,
|
|
113
|
+
severity: "block",
|
|
114
|
+
},
|
|
115
|
+
{
|
|
116
|
+
name: "Instruction boundary escape (XML)",
|
|
117
|
+
regex: /<\/?system>|<\/?instructions?>|<\/?prompt>/i,
|
|
118
|
+
severity: "block",
|
|
119
|
+
},
|
|
120
|
+
{
|
|
121
|
+
name: "Base64-encoded instruction injection",
|
|
122
|
+
regex: /(?:eval|decode|execute)\s*\(\s*(?:atob|base64|Buffer\.from)/i,
|
|
123
|
+
severity: "block",
|
|
124
|
+
},
|
|
125
|
+
{
|
|
126
|
+
name: "Hidden instruction delimiter",
|
|
127
|
+
regex: /---\s*(?:BEGIN|START)\s+(?:HIDDEN|SECRET|REAL)\s+(?:INSTRUCTIONS?|PROMPT)/i,
|
|
128
|
+
severity: "block",
|
|
129
|
+
},
|
|
130
|
+
// WARN-level: suspicious but possibly legitimate
|
|
131
|
+
{
|
|
132
|
+
name: "Disregard instruction",
|
|
133
|
+
regex: /(?:disregard|override|bypass|skip)\s+(?:the\s+)?(?:above|previous|prior|system)\s+(?:instructions?|rules?|constraints?)/i,
|
|
134
|
+
severity: "warn",
|
|
135
|
+
},
|
|
136
|
+
{
|
|
137
|
+
name: "Act as different entity",
|
|
138
|
+
regex: /(?:act|behave|pretend|respond)\s+(?:as|like)\s+(?:a|an|the|if\s+you\s+(?:are|were))/i,
|
|
139
|
+
severity: "warn",
|
|
140
|
+
},
|
|
141
|
+
{
|
|
142
|
+
name: "Jailbreak attempt",
|
|
143
|
+
regex: /(?:DAN|DUDE|jailbreak|do\s+anything\s+now)/i,
|
|
144
|
+
severity: "warn",
|
|
145
|
+
},
|
|
146
|
+
{
|
|
147
|
+
name: "Output manipulation",
|
|
148
|
+
regex: /(?:when\s+(?:asked|prompted|queried)|if\s+(?:anyone|someone)\s+asks)\s+.*(?:say|respond|output|answer)/i,
|
|
149
|
+
severity: "warn",
|
|
150
|
+
},
|
|
151
|
+
{
|
|
152
|
+
name: "Instruction in markdown comment",
|
|
153
|
+
regex: /<!--\s*(?:ignore|override|system|instruction)/i,
|
|
154
|
+
severity: "warn",
|
|
155
|
+
},
|
|
156
|
+
];
|
|
157
|
+
/**
|
|
158
|
+
* Scan content for prompt injection patterns.
|
|
159
|
+
*
|
|
160
|
+
* @param content - The text to scan (Plan Brief content, research summaries, etc.)
|
|
161
|
+
* @returns Scan result with detected patterns, severity, and matches.
|
|
162
|
+
*/
|
|
163
|
+
export function scanForInjection(content) {
|
|
164
|
+
const matches = [];
|
|
165
|
+
const lines = content.split("\n");
|
|
166
|
+
for (let lineIdx = 0; lineIdx < lines.length; lineIdx++) {
|
|
167
|
+
const line = lines[lineIdx];
|
|
168
|
+
for (const pattern of INJECTION_PATTERNS) {
|
|
169
|
+
const match = pattern.regex.exec(line);
|
|
170
|
+
if (match) {
|
|
171
|
+
matches.push({
|
|
172
|
+
pattern: pattern.name,
|
|
173
|
+
matched: match[0].slice(0, 100),
|
|
174
|
+
severity: pattern.severity,
|
|
175
|
+
line: lineIdx + 1,
|
|
176
|
+
});
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
// Determine highest severity
|
|
181
|
+
let severity = null;
|
|
182
|
+
if (matches.some((m) => m.severity === "block")) {
|
|
183
|
+
severity = "block";
|
|
184
|
+
}
|
|
185
|
+
else if (matches.length > 0) {
|
|
186
|
+
severity = "warn";
|
|
187
|
+
}
|
|
188
|
+
return {
|
|
189
|
+
detected: matches.length > 0,
|
|
190
|
+
severity,
|
|
191
|
+
matches,
|
|
192
|
+
};
|
|
193
|
+
}
|
|
194
|
+
// ---------------------------------------------------------------------------
|
|
195
|
+
// Content Sanitization
|
|
196
|
+
// ---------------------------------------------------------------------------
|
|
197
|
+
/**
|
|
198
|
+
* Wrap user-supplied content with clear delimiters so the LLM can distinguish
|
|
199
|
+
* between system instructions and user content.
|
|
200
|
+
*
|
|
201
|
+
* This doesn't prevent injection but makes it harder for injected instructions
|
|
202
|
+
* to be confused with system-level prompts.
|
|
203
|
+
*
|
|
204
|
+
* @param content - The user-supplied content
|
|
205
|
+
* @param label - A label describing what this content is (e.g., "Plan Brief", "Research Summary")
|
|
206
|
+
* @returns Content wrapped with delimiters
|
|
207
|
+
*/
|
|
208
|
+
export function wrapUserContent(content, label) {
|
|
209
|
+
return [
|
|
210
|
+
`<user-content label="${label}">`,
|
|
211
|
+
content,
|
|
212
|
+
`</user-content>`,
|
|
213
|
+
].join("\n");
|
|
214
|
+
}
|
|
215
|
+
/**
|
|
216
|
+
* Sanitize a filename to prevent path traversal via filename manipulation.
|
|
217
|
+
* Allows: alphanumeric, hyphens, underscores, dots.
|
|
218
|
+
* Rejects: slashes, null bytes, special characters.
|
|
219
|
+
*/
|
|
220
|
+
export function sanitizeFilename(name) {
|
|
221
|
+
// Reject null bytes
|
|
222
|
+
if (name.includes("\0")) {
|
|
223
|
+
throw new Error("Null byte detected in filename");
|
|
224
|
+
}
|
|
225
|
+
// Strip path separators and directory components
|
|
226
|
+
const base = name.replace(/.*[/\\]/, "");
|
|
227
|
+
// Replace unsafe characters
|
|
228
|
+
return base.replace(/[^a-zA-Z0-9._-]/g, "-").toLowerCase();
|
|
229
|
+
}
|
|
230
|
+
//# sourceMappingURL=security.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"security.js","sourceRoot":"","sources":["../../src/lib/security.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAC9C,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAE5C,8EAA8E;AAC9E,kBAAkB;AAClB,8EAA8E;AAE9E;;;;;;;;GAQG;AACH,MAAM,UAAU,YAAY,CAAC,QAAgB,EAAE,UAAkB;IAC/D,0DAA0D;IAC1D,IAAI,QAAQ,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,UAAU,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC;QACzD,MAAM,IAAI,kBAAkB,CAC1B,4BAA4B,EAC5B,UAAU,EACV,QAAQ,CACT,CAAC;IACJ,CAAC;IAED,MAAM,YAAY,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC;IACvC,MAAM,cAAc,GAAG,OAAO,CAAC,YAAY,EAAE,UAAU,CAAC,CAAC;IACzD,MAAM,GAAG,GAAG,QAAQ,CAAC,YAAY,EAAE,cAAc,CAAC,CAAC;IAEnD,kEAAkE;IAClE,IAAI,GAAG,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE,CAAC;QACzB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,OAAO;QACL,QAAQ,EAAE,OAAO,CAAC,MAAM,GAAG,CAAC;QAC5B,QAAQ;QACR,OAAO;KACR,CAAC;AACJ,CAAC;AAED,8EAA8E;AAC9E,uBAAuB;AACvB,8EAA8E;AAE9E;;;;;;;;;;GAUG;AACH,MAAM,UAAU,eAAe,CAAC,OAAe,EAAE,KAAa;IAC5D,OAAO;QACL,wBAAwB,KAAK,IAAI;QACjC,OAAO;QACP,iBAAiB;KAClB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACf,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,gBAAgB,CAAC,IAAY;IAC3C,oBAAoB;IACpB,IAAI,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC;QACxB,MAAM,IAAI,KAAK,CAAC,gCAAgC,CAAC,CAAC;IACpD,CAAC;IAED,iDAAiD;IACjD,MAAM,IAAI,GAAG,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,EAAE,CAAC,CAAC;IAEzC,4BAA4B;IAC5B,OAAO,IAAI,CAAC,OAAO,CAAC,kBAAkB,EAAE,GAAG,CAAC,CAAC,WAAW,EAAE,CAAC;AAC7D,CAAC"}
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,224 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared type definitions for solveos-cli.
|
|
3
|
+
*
|
|
4
|
+
* Covers: cycle states, state transitions, configuration, artifacts,
|
|
5
|
+
* and runtime adapter interface. This file is the single source of truth
|
|
6
|
+
* for all type contracts.
|
|
7
|
+
*
|
|
8
|
+
* NOTE: This file contains types only — everything is erased at compile time.
|
|
9
|
+
*/
|
|
10
|
+
/**
|
|
11
|
+
* The 11 states of a solveOS cycle.
|
|
12
|
+
* Maps directly to the state machine in docs/plan.md.
|
|
13
|
+
*/
|
|
14
|
+
export declare enum CycleState {
|
|
15
|
+
INIT = "INIT",
|
|
16
|
+
RESEARCHING = "RESEARCHING",
|
|
17
|
+
PLANNING = "PLANNING",
|
|
18
|
+
VALIDATING_PLAN = "VALIDATING_PLAN",
|
|
19
|
+
BUILDING = "BUILDING",
|
|
20
|
+
VALIDATING_BUILD = "VALIDATING_BUILD",
|
|
21
|
+
REVIEWING_PRE = "REVIEWING_PRE",
|
|
22
|
+
READY_TO_SHIP = "READY_TO_SHIP",
|
|
23
|
+
SHIPPED = "SHIPPED",
|
|
24
|
+
REVIEWING_POST = "REVIEWING_POST",
|
|
25
|
+
CYCLE_COMPLETE = "CYCLE_COMPLETE"
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* All valid state transitions. Each tuple is [from, to].
|
|
29
|
+
* Invalid transitions are not representable as this type.
|
|
30
|
+
*/
|
|
31
|
+
export type StateTransition = [CycleState.INIT, CycleState.RESEARCHING] | [CycleState.INIT, CycleState.PLANNING] | [CycleState.RESEARCHING, CycleState.PLANNING] | [CycleState.PLANNING, CycleState.VALIDATING_PLAN] | [CycleState.PLANNING, CycleState.BUILDING] | [CycleState.VALIDATING_PLAN, CycleState.PLANNING] | [CycleState.VALIDATING_PLAN, CycleState.BUILDING] | [CycleState.BUILDING, CycleState.VALIDATING_BUILD] | [CycleState.BUILDING, CycleState.REVIEWING_PRE] | [CycleState.BUILDING, CycleState.READY_TO_SHIP] | [CycleState.VALIDATING_BUILD, CycleState.BUILDING] | [CycleState.VALIDATING_BUILD, CycleState.PLANNING] | [CycleState.VALIDATING_BUILD, CycleState.REVIEWING_PRE] | [CycleState.VALIDATING_BUILD, CycleState.READY_TO_SHIP] | [CycleState.REVIEWING_PRE, CycleState.BUILDING] | [CycleState.REVIEWING_PRE, CycleState.READY_TO_SHIP] | [CycleState.READY_TO_SHIP, CycleState.SHIPPED] | [CycleState.SHIPPED, CycleState.REVIEWING_POST] | [CycleState.SHIPPED, CycleState.CYCLE_COMPLETE] | [CycleState.REVIEWING_POST, CycleState.CYCLE_COMPLETE] | [CycleState.CYCLE_COMPLETE, CycleState.INIT];
|
|
32
|
+
/** Gate toggle flags — each gate can be independently enabled/disabled. */
|
|
33
|
+
export interface GateConfig {
|
|
34
|
+
research: boolean;
|
|
35
|
+
plan_validation: boolean;
|
|
36
|
+
build_validation: boolean;
|
|
37
|
+
review_pre_ship: boolean;
|
|
38
|
+
review_post_ship: boolean;
|
|
39
|
+
}
|
|
40
|
+
/** Domain setting — adjusts agent prompts and artifact templates. */
|
|
41
|
+
export type Domain = "software" | "content" | "research" | "strategy" | "general";
|
|
42
|
+
/** Interaction mode. */
|
|
43
|
+
export type Mode = "interactive" | "auto";
|
|
44
|
+
/** Work decomposition granularity for the Build phase. */
|
|
45
|
+
export type Granularity = "coarse" | "standard" | "fine";
|
|
46
|
+
/** Supported AI coding assistant runtimes. */
|
|
47
|
+
export type Runtime = "opencode" | "claude-code" | "cursor" | "gemini" | "auto";
|
|
48
|
+
/** Project-level configuration stored in .solveos/config.json. */
|
|
49
|
+
export interface Config {
|
|
50
|
+
mode: Mode;
|
|
51
|
+
gates: GateConfig;
|
|
52
|
+
plan_validation_max_passes: number;
|
|
53
|
+
granularity: Granularity;
|
|
54
|
+
auto_advance: boolean;
|
|
55
|
+
domain: Domain;
|
|
56
|
+
runtime: Runtime;
|
|
57
|
+
hooks: HookConfig;
|
|
58
|
+
}
|
|
59
|
+
/** Hook configuration — controls context monitor and brief anchor behavior. */
|
|
60
|
+
export interface HookConfig {
|
|
61
|
+
/** Enable the context monitor plugin. */
|
|
62
|
+
context_monitor: boolean;
|
|
63
|
+
/** Message count threshold before warning (proxy for context usage). Default 60. */
|
|
64
|
+
context_monitor_threshold: number;
|
|
65
|
+
/** Enable the brief anchor plugin. */
|
|
66
|
+
brief_anchor: boolean;
|
|
67
|
+
/** Tool call interval between brief anchor reminders during Build. Default 10. */
|
|
68
|
+
brief_anchor_interval: number;
|
|
69
|
+
}
|
|
70
|
+
/** The names of gates that can be skipped or completed. */
|
|
71
|
+
export type GateName = "RESEARCH" | "PLAN_VALIDATION" | "BUILD_VALIDATION" | "REVIEW_PRE_SHIP" | "REVIEW_POST_SHIP";
|
|
72
|
+
/** A single entry in the transitions log — records every state change. */
|
|
73
|
+
export interface TransitionLogEntry {
|
|
74
|
+
from: CycleState;
|
|
75
|
+
to: CycleState;
|
|
76
|
+
at: string;
|
|
77
|
+
gate_skipped?: GateName;
|
|
78
|
+
gate_completed?: GateName;
|
|
79
|
+
}
|
|
80
|
+
/** Structured data tracked in .solveos/STATE.md. */
|
|
81
|
+
export interface CycleStateData {
|
|
82
|
+
current_state: CycleState;
|
|
83
|
+
cycle_number: number;
|
|
84
|
+
gates_skipped: GateName[];
|
|
85
|
+
gates_completed: GateName[];
|
|
86
|
+
plan_validation_passes: number;
|
|
87
|
+
blockers: string[];
|
|
88
|
+
transitions_log: TransitionLogEntry[];
|
|
89
|
+
created_at: string;
|
|
90
|
+
updated_at: string;
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* The Plan Brief — the central artifact of every solveOS cycle.
|
|
94
|
+
* Maps to the 8 questions from the solveOS framework.
|
|
95
|
+
*/
|
|
96
|
+
export interface PlanBrief {
|
|
97
|
+
/** What problem are we solving? */
|
|
98
|
+
problem: string;
|
|
99
|
+
/** Who is this for? */
|
|
100
|
+
audience: string;
|
|
101
|
+
/** What does success look like? */
|
|
102
|
+
goal: string;
|
|
103
|
+
/** How much time/effort are we willing to spend? */
|
|
104
|
+
appetite: string;
|
|
105
|
+
/** What are the constraints? (tech stack, style, etc.) */
|
|
106
|
+
constraints: string[];
|
|
107
|
+
/** How will we know this is done? (measurable criteria) */
|
|
108
|
+
success_criteria: string[];
|
|
109
|
+
/** What is the core assumption we're betting on? */
|
|
110
|
+
core_assumption: string;
|
|
111
|
+
/** Known rabbit holes to avoid. */
|
|
112
|
+
rabbit_holes: string[];
|
|
113
|
+
/** Explicitly out of scope. */
|
|
114
|
+
out_of_scope: string[];
|
|
115
|
+
}
|
|
116
|
+
/** Status of an individual work unit. */
|
|
117
|
+
export type WorkUnitStatus = "pending" | "in_progress" | "completed" | "failed" | "skipped";
|
|
118
|
+
/**
|
|
119
|
+
* An atomic unit of work within the Build phase.
|
|
120
|
+
* Each unit maps to at least one success criterion and can declare
|
|
121
|
+
* dependencies on other units.
|
|
122
|
+
*/
|
|
123
|
+
export interface WorkUnit {
|
|
124
|
+
/** Unique identifier within this execution plan (e.g., "unit-1"). */
|
|
125
|
+
id: string;
|
|
126
|
+
/** Human-readable name. */
|
|
127
|
+
name: string;
|
|
128
|
+
/** What this unit does — detailed enough for an agent to execute. */
|
|
129
|
+
description: string;
|
|
130
|
+
/** IDs of units that must complete before this one can start. */
|
|
131
|
+
depends_on: string[];
|
|
132
|
+
/** Which success criteria from the Plan Brief this unit verifies. */
|
|
133
|
+
criteria: string[];
|
|
134
|
+
/** Current execution status. */
|
|
135
|
+
status: WorkUnitStatus;
|
|
136
|
+
/** Output summary after execution (filled in by the executor). */
|
|
137
|
+
summary?: string;
|
|
138
|
+
/** Error message if the unit failed. */
|
|
139
|
+
error?: string;
|
|
140
|
+
/** Whether this was discovered during execution (not in original decomposition). */
|
|
141
|
+
discovered?: boolean;
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* A wave — a group of independent work units that can execute in parallel.
|
|
145
|
+
* All units in a wave have their dependencies satisfied by prior waves.
|
|
146
|
+
*/
|
|
147
|
+
export interface Wave {
|
|
148
|
+
/** Wave number (1-indexed). */
|
|
149
|
+
number: number;
|
|
150
|
+
/** IDs of work units in this wave. */
|
|
151
|
+
unit_ids: string[];
|
|
152
|
+
/** Wave status: pending until all units start, completed when all finish. */
|
|
153
|
+
status: "pending" | "in_progress" | "completed" | "failed";
|
|
154
|
+
}
|
|
155
|
+
/**
|
|
156
|
+
* The complete wave execution plan for a Build phase.
|
|
157
|
+
* Produced by decomposition + dependency analysis + wave grouping.
|
|
158
|
+
*/
|
|
159
|
+
export interface WaveExecutionPlan {
|
|
160
|
+
/** All work units. */
|
|
161
|
+
units: WorkUnit[];
|
|
162
|
+
/** Waves (ordered by execution sequence). */
|
|
163
|
+
waves: Wave[];
|
|
164
|
+
/** Granularity setting used for decomposition. */
|
|
165
|
+
granularity: Granularity;
|
|
166
|
+
/** Whether this plan has a single unit (bypasses wave overhead). */
|
|
167
|
+
single_unit: boolean;
|
|
168
|
+
/** Timestamp of plan creation. */
|
|
169
|
+
created_at: string;
|
|
170
|
+
}
|
|
171
|
+
/**
|
|
172
|
+
* Result of executing a wave execution plan.
|
|
173
|
+
*/
|
|
174
|
+
export interface WaveExecutionResult {
|
|
175
|
+
/** Overall status. */
|
|
176
|
+
status: "completed" | "partial" | "failed";
|
|
177
|
+
/** Number of units completed. */
|
|
178
|
+
units_completed: number;
|
|
179
|
+
/** Total number of units. */
|
|
180
|
+
units_total: number;
|
|
181
|
+
/** Discovered tasks added during execution. */
|
|
182
|
+
discovered_tasks: number;
|
|
183
|
+
/** Per-wave summaries. */
|
|
184
|
+
wave_summaries: WaveSummary[];
|
|
185
|
+
/** Completion timestamp. */
|
|
186
|
+
completed_at: string;
|
|
187
|
+
}
|
|
188
|
+
/**
|
|
189
|
+
* Summary of a single wave's execution.
|
|
190
|
+
*/
|
|
191
|
+
export interface WaveSummary {
|
|
192
|
+
/** Wave number. */
|
|
193
|
+
wave_number: number;
|
|
194
|
+
/** Units that completed successfully. */
|
|
195
|
+
completed: string[];
|
|
196
|
+
/** Units that failed. */
|
|
197
|
+
failed: string[];
|
|
198
|
+
/** Units that were skipped (due to dependency failures). */
|
|
199
|
+
skipped: string[];
|
|
200
|
+
}
|
|
201
|
+
/** Result of runtime detection. */
|
|
202
|
+
export interface DetectResult {
|
|
203
|
+
/** Whether the runtime was detected. */
|
|
204
|
+
detected: boolean;
|
|
205
|
+
/** Human-readable name of the detected runtime. */
|
|
206
|
+
name: string;
|
|
207
|
+
/** Path to the runtime's config directory or file, if found. */
|
|
208
|
+
configPath?: string;
|
|
209
|
+
}
|
|
210
|
+
/**
|
|
211
|
+
* Interface that each runtime adapter must implement.
|
|
212
|
+
* Handles detection and installation for a specific AI coding assistant.
|
|
213
|
+
*/
|
|
214
|
+
export interface RuntimeAdapter {
|
|
215
|
+
/** Check if this runtime is available in the current project/environment. */
|
|
216
|
+
detect(): Promise<DetectResult>;
|
|
217
|
+
/** Install slash command .md files to the runtime's command directory. */
|
|
218
|
+
installCommands(sourceDir: string): Promise<void>;
|
|
219
|
+
/** Install agent .md files to the runtime's agent directory. */
|
|
220
|
+
installAgents(sourceDir: string): Promise<void>;
|
|
221
|
+
/** Install compiled hook .js files to the runtime's hook directory. */
|
|
222
|
+
installHooks(sourceDir: string): Promise<void>;
|
|
223
|
+
}
|
|
224
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAMH;;;GAGG;AACH,oBAAY,UAAU;IACpB,IAAI,SAAS;IACb,WAAW,gBAAgB;IAC3B,QAAQ,aAAa;IACrB,eAAe,oBAAoB;IACnC,QAAQ,aAAa;IACrB,gBAAgB,qBAAqB;IACrC,aAAa,kBAAkB;IAC/B,aAAa,kBAAkB;IAC/B,OAAO,YAAY;IACnB,cAAc,mBAAmB;IACjC,cAAc,mBAAmB;CAClC;AAMD;;;GAGG;AACH,MAAM,MAAM,eAAe,GAEvB,CAAC,UAAU,CAAC,IAAI,EAAE,UAAU,CAAC,WAAW,CAAC,GACzC,CAAC,UAAU,CAAC,IAAI,EAAE,UAAU,CAAC,QAAQ,CAAC,GAEtC,CAAC,UAAU,CAAC,WAAW,EAAE,UAAU,CAAC,QAAQ,CAAC,GAE7C,CAAC,UAAU,CAAC,QAAQ,EAAE,UAAU,CAAC,eAAe,CAAC,GACjD,CAAC,UAAU,CAAC,QAAQ,EAAE,UAAU,CAAC,QAAQ,CAAC,GAE1C,CAAC,UAAU,CAAC,eAAe,EAAE,UAAU,CAAC,QAAQ,CAAC,GACjD,CAAC,UAAU,CAAC,eAAe,EAAE,UAAU,CAAC,QAAQ,CAAC,GAEjD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gEAAgE;IAChE,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED;;;GAGG;AACH,MAAM,WAAW,cAAc;IAC7B,6EAA6E;IAC7E,MAAM,IAAI,OAAO,CAAC,YAAY,CAAC,CAAC;IAChC,0EAA0E;IAC1E,eAAe,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAClD,gEAAgE;IAChE,aAAa,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAChD,uEAAuE;IACvE,YAAY,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CAChD"}
|
package/dist/types.js
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared type definitions for solveos-cli.
|
|
3
|
+
*
|
|
4
|
+
* Covers: cycle states, state transitions, configuration, artifacts,
|
|
5
|
+
* and runtime adapter interface. This file is the single source of truth
|
|
6
|
+
* for all type contracts.
|
|
7
|
+
*
|
|
8
|
+
* NOTE: This file contains types only — everything is erased at compile time.
|
|
9
|
+
*/
|
|
10
|
+
// ---------------------------------------------------------------------------
|
|
11
|
+
// Cycle States
|
|
12
|
+
// ---------------------------------------------------------------------------
|
|
13
|
+
/**
|
|
14
|
+
* The 11 states of a solveOS cycle.
|
|
15
|
+
* Maps directly to the state machine in docs/plan.md.
|
|
16
|
+
*/
|
|
17
|
+
export var CycleState;
|
|
18
|
+
(function (CycleState) {
|
|
19
|
+
CycleState["INIT"] = "INIT";
|
|
20
|
+
CycleState["RESEARCHING"] = "RESEARCHING";
|
|
21
|
+
CycleState["PLANNING"] = "PLANNING";
|
|
22
|
+
CycleState["VALIDATING_PLAN"] = "VALIDATING_PLAN";
|
|
23
|
+
CycleState["BUILDING"] = "BUILDING";
|
|
24
|
+
CycleState["VALIDATING_BUILD"] = "VALIDATING_BUILD";
|
|
25
|
+
CycleState["REVIEWING_PRE"] = "REVIEWING_PRE";
|
|
26
|
+
CycleState["READY_TO_SHIP"] = "READY_TO_SHIP";
|
|
27
|
+
CycleState["SHIPPED"] = "SHIPPED";
|
|
28
|
+
CycleState["REVIEWING_POST"] = "REVIEWING_POST";
|
|
29
|
+
CycleState["CYCLE_COMPLETE"] = "CYCLE_COMPLETE";
|
|
30
|
+
})(CycleState || (CycleState = {}));
|
|
31
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,8EAA8E;AAC9E,eAAe;AACf,8EAA8E;AAE9E;;;GAGG;AACH,MAAM,CAAN,IAAY,UAYX;AAZD,WAAY,UAAU;IACpB,2BAAa,CAAA;IACb,yCAA2B,CAAA;IAC3B,mCAAqB,CAAA;IACrB,iDAAmC,CAAA;IACnC,mCAAqB,CAAA;IACrB,mDAAqC,CAAA;IACrC,6CAA+B,CAAA;IAC/B,6CAA+B,CAAA;IAC/B,iCAAmB,CAAA;IACnB,+CAAiC,CAAA;IACjC,+CAAiC,CAAA;AACnC,CAAC,EAZW,UAAU,KAAV,UAAU,QAYrB"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Cycle state machine for solveos-cli.
|
|
3
|
+
*
|
|
4
|
+
* Tracks which phase/gate the user is in, enforces valid transitions,
|
|
5
|
+
* and provides helpers for state queries. Persistence (load/save to
|
|
6
|
+
* .solveos/STATE.md) is handled by the artifacts module.
|
|
7
|
+
*
|
|
8
|
+
* The transition map encodes all ~20 valid transitions from docs/plan.md.
|
|
9
|
+
* Invalid transitions throw — they are programming errors, not user errors.
|
|
10
|
+
*/
|
|
11
|
+
import { CycleState } from "../types.js";
|
|
12
|
+
import type { CycleStateData, GateName, StateTransition } from "../types.js";
|
|
13
|
+
export interface TransitionResult {
|
|
14
|
+
/** The transition that was applied. */
|
|
15
|
+
transition: StateTransition;
|
|
16
|
+
/** Updated state data after the transition. */
|
|
17
|
+
stateData: CycleStateData;
|
|
18
|
+
/** Gates that were skipped by this transition. */
|
|
19
|
+
gatesSkipped: GateName[];
|
|
20
|
+
/** Gate that was completed by this transition, if any. */
|
|
21
|
+
gateCompleted: GateName | null;
|
|
22
|
+
/** Whether the plan validation max passes was reached (escalation signal). */
|
|
23
|
+
planValidationEscalation: boolean;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Validate and apply a state transition.
|
|
27
|
+
*
|
|
28
|
+
* @param stateData - Current cycle state data.
|
|
29
|
+
* @param target - The desired next state.
|
|
30
|
+
* @param maxPlanValidationPasses - From config; defaults to 3.
|
|
31
|
+
* @returns TransitionResult with updated state data and metadata.
|
|
32
|
+
* @throws Error if the transition is invalid.
|
|
33
|
+
*/
|
|
34
|
+
export declare function transition(stateData: CycleStateData, target: CycleState, maxPlanValidationPasses?: number): TransitionResult;
|
|
35
|
+
/**
|
|
36
|
+
* Get all valid next states from the current state.
|
|
37
|
+
*/
|
|
38
|
+
export declare function getNextStates(currentState: CycleState): CycleState[];
|
|
39
|
+
/**
|
|
40
|
+
* Check if a transition is valid without applying it.
|
|
41
|
+
*/
|
|
42
|
+
export declare function isValidTransition(from: CycleState, to: CycleState): boolean;
|
|
43
|
+
/**
|
|
44
|
+
* Create initial state data for a new cycle.
|
|
45
|
+
*/
|
|
46
|
+
export declare function createInitialState(cycleNumber?: number): CycleStateData;
|
|
47
|
+
/**
|
|
48
|
+
* Get a human-readable description of the current state.
|
|
49
|
+
*/
|
|
50
|
+
export declare function describeState(state: CycleState): string;
|
|
51
|
+
/**
|
|
52
|
+
* Get the suggested next command for a given state.
|
|
53
|
+
*/
|
|
54
|
+
export declare function suggestNextCommand(state: CycleState): string;
|
|
55
|
+
//# sourceMappingURL=state-machine.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"state-machine.d.ts","sourceRoot":"","sources":["../../src/workflows/state-machine.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,KAAK,EAAE,cAAc,EAAE,QAAQ,EAAE,eAAe,EAAsB,MAAM,aAAa,CAAC;AAmJjG,MAAM,WAAW,gBAAgB;IAC/B,uCAAuC;IACvC,UAAU,EAAE,eAAe,CAAC;IAC5B,+CAA+C;IAC/C,SAAS,EAAE,cAAc,CAAC;IAC1B,kDAAkD;IAClD,YAAY,EAAE,QAAQ,EAAE,CAAC;IACzB,0DAA0D;IAC1D,aAAa,EAAE,QAAQ,GAAG,IAAI,CAAC;IAC/B,8EAA8E;IAC9E,wBAAwB,EAAE,OAAO,CAAC;CACnC;AAMD;;;;;;;;GAQG;AACH,wBAAgB,UAAU,CACxB,SAAS,EAAE,cAAc,EACzB,MAAM,EAAE,UAAU,EAClB,uBAAuB,GAAE,MAAU,GAClC,gBAAgB,CA4ElB;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,YAAY,EAAE,UAAU,GAAG,UAAU,EAAE,CAEpE;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAC/B,IAAI,EAAE,UAAU,EAChB,EAAE,EAAE,UAAU,GACb,OAAO,CAET;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,WAAW,GAAE,MAAU,GAAG,cAAc,CAa1E;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,UAAU,GAAG,MAAM,CAevD;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,UAAU,GAAG,MAAM,CAe5D"}
|