docs: Update README and FINAL_STATUS for quick start setup and project readiness
Some checks failed
Security Scan / OWASP ZAP Scan (push) Failing after 8s
Security Scan / Dependency Vulnerability Scan (push) Failing after 14m23s

- Added quick start instructions in README.md for first-time setup, including commands for complete setup, verification, and service start.
- Revised FINAL_STATUS.md to reflect the project's infrastructure completion and readiness for execution, detailing scripts created and documentation status.
This commit is contained in:
defiQUG
2025-11-06 21:31:55 -08:00
parent 3dc8592b83
commit b118b2be9c
23 changed files with 3068 additions and 90 deletions

View File

@@ -2,10 +2,63 @@ import type { Request, Response } from "express";
import { v4 as uuidv4 } from "uuid";
import { createHash } from "crypto";
import { validatePlan, checkStepDependencies } from "../services/planValidation";
import { storePlan, getPlanById, updatePlanSignature } from "../db/plans";
import { storePlan, getPlanById, updatePlanSignature, listPlans } from "../db/plans";
import { asyncHandler, AppError, ErrorType } from "../services/errorHandler";
import type { Plan, PlanStep } from "../types/plan";
/**
* GET /api/plans
* List all plans (with optional query parameters)
*
* @swagger
* /api/plans:
* get:
* summary: List all execution plans
* parameters:
* - in: query
* name: creator
* schema:
* type: string
* description: Filter by creator
* - in: query
* name: status
* schema:
* type: string
* description: Filter by status
* - in: query
* name: limit
* schema:
* type: integer
* description: Limit number of results
* - in: query
* name: offset
* schema:
* type: integer
* description: Offset for pagination
* responses:
* 200:
* description: List of plans
*
* @param req - Express request with optional query parameters
* @param res - Express response
* @returns Array of plans
*/
export const listPlansEndpoint = asyncHandler(async (req: Request, res: Response) => {
const creator = req.query.creator as string | undefined;
const status = req.query.status as string | undefined;
const limit = req.query.limit ? parseInt(req.query.limit as string, 10) : undefined;
const offset = req.query.offset ? parseInt(req.query.offset as string, 10) : undefined;
const plans = await listPlans({
creator,
status,
limit: limit || 50, // Default limit
offset,
});
res.json(plans);
});
/**
* POST /api/plans
* Create a new execution plan

View File

@@ -99,3 +99,57 @@ export async function updatePlanStatus(
[status, planId]
);
}
/**
* List all plans (with optional filtering)
*/
export async function listPlans(options?: {
creator?: string;
status?: string;
limit?: number;
offset?: number;
}): Promise<Plan[]> {
let queryText = "SELECT * FROM plans WHERE 1=1";
const params: any[] = [];
let paramIndex = 1;
if (options?.creator) {
queryText += ` AND creator = $${paramIndex}`;
params.push(options.creator);
paramIndex++;
}
if (options?.status) {
queryText += ` AND status = $${paramIndex}`;
params.push(options.status);
paramIndex++;
}
queryText += " ORDER BY created_at DESC";
if (options?.limit) {
queryText += ` LIMIT $${paramIndex}`;
params.push(options.limit);
paramIndex++;
}
if (options?.offset) {
queryText += ` OFFSET $${paramIndex}`;
params.push(options.offset);
paramIndex++;
}
const result = await query<any>(queryText, params);
return result.map((row) => ({
plan_id: row.plan_id,
creator: row.creator,
steps: typeof row.steps === "string" ? JSON.parse(row.steps) : row.steps,
maxRecursion: row.max_recursion,
maxLTV: row.max_ltv,
signature: row.signature,
plan_hash: row.plan_hash,
created_at: row.created_at ? (row.created_at instanceof Date ? row.created_at.toISOString() : String(row.created_at)) : undefined,
status: row.status,
}));
}

View File

@@ -14,7 +14,7 @@ import { requestTimeout } from "./middleware/timeout";
import { logger } from "./logging/logger";
import { getMetrics, httpRequestDuration, httpRequestTotal, register } from "./metrics/prometheus";
import { healthCheck, readinessCheck, livenessCheck } from "./health/health";
import { createPlan, getPlan, addSignature, validatePlanEndpoint } from "./api/plans";
import { listPlansEndpoint, createPlan, getPlan, addSignature, validatePlanEndpoint } from "./api/plans";
import { streamPlanStatus } from "./api/sse";
import { executionCoordinator } from "./services/execution";
import { runMigration } from "./db/migrations";
@@ -85,6 +85,7 @@ app.get("/metrics", async (req, res) => {
app.use("/api", apiLimiter);
// Plan management endpoints
app.get("/api/plans", listPlansEndpoint);
app.post("/api/plans", auditLog("CREATE_PLAN", "plan"), createPlan);
app.get("/api/plans/:planId", getPlan);
app.post("/api/plans/:planId/signature", addSignature);