@qlucent/fishi-core 0.7.0 → 0.8.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/dist/index.d.ts CHANGED
@@ -1,3 +1,5 @@
1
+ import { ChildProcess } from 'child_process';
2
+
1
3
  type ProjectType = 'greenfield' | 'brownfield' | 'hybrid';
2
4
  type CostMode = 'performance' | 'balanced' | 'economy';
3
5
  type ModelTier = 'opus' | 'sonnet' | 'haiku';
@@ -620,10 +622,31 @@ declare function runInSandbox(command: string, args: string[], worktreePath: str
620
622
  nodeModulesPath?: string;
621
623
  }): SandboxRunResult;
622
624
 
625
+ interface DevServerConfig {
626
+ command: string;
627
+ args: string[];
628
+ port: number;
629
+ framework: string;
630
+ detected: boolean;
631
+ }
632
+ /**
633
+ * Detect the dev server command from package.json scripts or framework detection.
634
+ */
635
+ declare function detectDevServer(projectDir: string, customCmd?: string): DevServerConfig;
636
+ /**
637
+ * Start the dev server as a background process.
638
+ * Returns the child process handle.
639
+ */
640
+ declare function startDevServer(projectDir: string, config: DevServerConfig): ChildProcess;
641
+ /**
642
+ * Get the vibe mode config for fishi.yaml.
643
+ */
644
+ declare function getVibeModeConfig(enabled: boolean): string;
645
+
623
646
  declare function getSandboxPolicyTemplate(): string;
624
647
 
625
648
  declare function getDockerfileTemplate(): string;
626
649
 
627
650
  declare function getDashboardHtml(): string;
628
651
 
629
- export { type AgentDefinition, type AgentRole, type AgentTemplate, type BackupManifest, type BrownfieldAnalysisData, type ClaudeMdOptions, type CommandTemplate, type ConflictCategory, type ConflictMap, type ConflictResolution, type CostMode, type DetectionCheck, type DetectionResult, type DynamicAgent, type DynamicAgentConfig, type ExecutionConfig, type FileConflict, type FileResolutionMap, type FishiConfig, type FishiYamlOptions, type GateConfig, type GateStatus, type GitConfig, type HookTemplate, type InitOptions, type McpConfig, type McpServerConfig, type ModelRoutingConfig, type ModelTier, type MonitorEvent, type MonitorState, type MonitorSummary, type ProjectConfig, type ProjectType, type ProjectYamlOptions, type SandboxConfig, type SandboxMode, type SandboxPolicy, type SandboxRunResult, type ScaffoldOptions, type ScaffoldResult, type SkillTemplate, type StateConfig, type TaskStatus, type TaskboardConfig, type TemplateContext, architectAgentTemplate, backendAgentTemplate, buildSandboxEnv, createBackup, detectConflicts, detectDocker, devLeadTemplate, devopsAgentTemplate, docsAgentTemplate, emitEvent, frontendAgentTemplate, fullstackAgentTemplate, generateScaffold, getAdaptiveTaskGraphSkill, getAgentCompleteHook, getAgentFactoryTemplate, getAgentRegistryTemplate, getAgentSummary, getApiDesignSkill, getAutoCheckpointHook, getBoardCommand, getBrainstormingSkill, getBrownfieldAnalysisSkill, getBrownfieldDiscoverySkill, getClaudeMdTemplate, getCodeGenSkill, getCoordinatorFactoryTemplate, getDashboardHtml, getDebuggingSkill, getDeploymentSkill, getDocCheckerScript, getDockerfileTemplate, getDocumentationSkill, getFishiYamlTemplate, getGateCommand, getGateManagerScript, getGitignoreAdditions, getInitCommand, getLearningsManagerScript, getMasterOrchestratorTemplate, getMcpJsonTemplate, getMemoryManagerScript, getModelRoutingReference, getMonitorEmitterScript, getPhaseRunnerScript, getPostEditHook, getPrdCommand, getPrdSkill, getProjectYamlTemplate, getResetCommand, getResumeCommand, getSafetyCheckHook, getSandboxPolicyTemplate, getSessionStartHook, getSettingsJsonTemplate, getSprintCommand, getStatusCommand, getTaskboardOpsSkill, getTaskboardUpdateHook, getTestingSkill, getTodoManagerScript, getValidateScaffoldScript, getWorktreeManagerScript, getWorktreeSetupHook, marketingAgentTemplate, mergeClaudeMd, mergeClaudeMdTop, mergeGitignore, mergeMcpJson, mergeSettingsJson, opsLeadTemplate, planningAgentTemplate, planningLeadTemplate, qualityLeadTemplate, readMonitorState, readSandboxConfig, readSandboxPolicy, researchAgentTemplate, runInDockerSandbox, runInProcessSandbox, runInSandbox, securityAgentTemplate, testingAgentTemplate, uiuxAgentTemplate, writingAgentTemplate };
652
+ export { type AgentDefinition, type AgentRole, type AgentTemplate, type BackupManifest, type BrownfieldAnalysisData, type ClaudeMdOptions, type CommandTemplate, type ConflictCategory, type ConflictMap, type ConflictResolution, type CostMode, type DetectionCheck, type DetectionResult, type DevServerConfig, type DynamicAgent, type DynamicAgentConfig, type ExecutionConfig, type FileConflict, type FileResolutionMap, type FishiConfig, type FishiYamlOptions, type GateConfig, type GateStatus, type GitConfig, type HookTemplate, type InitOptions, type McpConfig, type McpServerConfig, type ModelRoutingConfig, type ModelTier, type MonitorEvent, type MonitorState, type MonitorSummary, type ProjectConfig, type ProjectType, type ProjectYamlOptions, type SandboxConfig, type SandboxMode, type SandboxPolicy, type SandboxRunResult, type ScaffoldOptions, type ScaffoldResult, type SkillTemplate, type StateConfig, type TaskStatus, type TaskboardConfig, type TemplateContext, architectAgentTemplate, backendAgentTemplate, buildSandboxEnv, createBackup, detectConflicts, detectDevServer, detectDocker, devLeadTemplate, devopsAgentTemplate, docsAgentTemplate, emitEvent, frontendAgentTemplate, fullstackAgentTemplate, generateScaffold, getAdaptiveTaskGraphSkill, getAgentCompleteHook, getAgentFactoryTemplate, getAgentRegistryTemplate, getAgentSummary, getApiDesignSkill, getAutoCheckpointHook, getBoardCommand, getBrainstormingSkill, getBrownfieldAnalysisSkill, getBrownfieldDiscoverySkill, getClaudeMdTemplate, getCodeGenSkill, getCoordinatorFactoryTemplate, getDashboardHtml, getDebuggingSkill, getDeploymentSkill, getDocCheckerScript, getDockerfileTemplate, getDocumentationSkill, getFishiYamlTemplate, getGateCommand, getGateManagerScript, getGitignoreAdditions, getInitCommand, getLearningsManagerScript, getMasterOrchestratorTemplate, getMcpJsonTemplate, getMemoryManagerScript, getModelRoutingReference, getMonitorEmitterScript, getPhaseRunnerScript, getPostEditHook, getPrdCommand, getPrdSkill, getProjectYamlTemplate, getResetCommand, getResumeCommand, getSafetyCheckHook, getSandboxPolicyTemplate, getSessionStartHook, getSettingsJsonTemplate, getSprintCommand, getStatusCommand, getTaskboardOpsSkill, getTaskboardUpdateHook, getTestingSkill, getTodoManagerScript, getValidateScaffoldScript, getVibeModeConfig, getWorktreeManagerScript, getWorktreeSetupHook, marketingAgentTemplate, mergeClaudeMd, mergeClaudeMdTop, mergeGitignore, mergeMcpJson, mergeSettingsJson, opsLeadTemplate, planningAgentTemplate, planningLeadTemplate, qualityLeadTemplate, readMonitorState, readSandboxConfig, readSandboxPolicy, researchAgentTemplate, runInDockerSandbox, runInProcessSandbox, runInSandbox, securityAgentTemplate, startDevServer, testingAgentTemplate, uiuxAgentTemplate, writingAgentTemplate };
package/dist/index.js CHANGED
@@ -11111,7 +11111,7 @@ async function createBackup(targetDir, conflictingFiles) {
11111
11111
  manifestFiles.push({ path: relPath, size: stat.size });
11112
11112
  }
11113
11113
  }
11114
- const fishiVersion = "0.7.0";
11114
+ const fishiVersion = "0.8.0";
11115
11115
  const manifest = {
11116
11116
  timestamp: now.toISOString(),
11117
11117
  fishi_version: fishiVersion,
@@ -11368,6 +11368,104 @@ function runInSandbox(command, args, worktreePath, projectDir, options = {}) {
11368
11368
  return runInProcessSandbox(command, args, worktreePath, policy);
11369
11369
  }
11370
11370
 
11371
+ // src/generators/preview-server.ts
11372
+ import { existsSync as existsSync6, readFileSync as readFileSync3 } from "fs";
11373
+ import { join as join6 } from "path";
11374
+ import { spawn as spawn2 } from "child_process";
11375
+ function detectDevServer(projectDir, customCmd) {
11376
+ if (customCmd) {
11377
+ const parts = customCmd.split(/\s+/);
11378
+ return {
11379
+ command: parts[0],
11380
+ args: parts.slice(1),
11381
+ port: 3e3,
11382
+ framework: "custom",
11383
+ detected: true
11384
+ };
11385
+ }
11386
+ const pkgPath = join6(projectDir, "package.json");
11387
+ if (!existsSync6(pkgPath)) {
11388
+ if (existsSync6(join6(projectDir, "manage.py"))) {
11389
+ return { command: "python", args: ["manage.py", "runserver"], port: 8e3, framework: "django", detected: true };
11390
+ }
11391
+ if (existsSync6(join6(projectDir, "requirements.txt"))) {
11392
+ const reqs = readFileSync3(join6(projectDir, "requirements.txt"), "utf-8");
11393
+ if (reqs.includes("flask")) return { command: "python", args: ["-m", "flask", "run"], port: 5e3, framework: "flask", detected: true };
11394
+ if (reqs.includes("fastapi")) return { command: "uvicorn", args: ["main:app", "--reload"], port: 8e3, framework: "fastapi", detected: true };
11395
+ }
11396
+ return { command: "", args: [], port: 3e3, framework: "unknown", detected: false };
11397
+ }
11398
+ const pkg = JSON.parse(readFileSync3(pkgPath, "utf-8"));
11399
+ const scripts = pkg.scripts || {};
11400
+ if (scripts.dev) {
11401
+ const devCmd = scripts.dev;
11402
+ const port = extractPort(devCmd) || 3e3;
11403
+ const framework = detectFrameworkFromCmd(devCmd, pkg);
11404
+ return { command: "npm", args: ["run", "dev"], port, framework, detected: true };
11405
+ }
11406
+ if (scripts.start) {
11407
+ const port = extractPort(scripts.start) || 3e3;
11408
+ const framework = detectFrameworkFromCmd(scripts.start, pkg);
11409
+ return { command: "npm", args: ["run", "start"], port, framework, detected: true };
11410
+ }
11411
+ const deps = { ...pkg.dependencies, ...pkg.devDependencies };
11412
+ if (deps["next"]) return { command: "npx", args: ["next", "dev"], port: 3e3, framework: "nextjs", detected: true };
11413
+ if (deps["vite"]) return { command: "npx", args: ["vite"], port: 5173, framework: "vite", detected: true };
11414
+ if (deps["astro"]) return { command: "npx", args: ["astro", "dev"], port: 4321, framework: "astro", detected: true };
11415
+ if (deps["nuxt"]) return { command: "npx", args: ["nuxt", "dev"], port: 3e3, framework: "nuxt", detected: true };
11416
+ if (deps["svelte-kit"] || deps["@sveltejs/kit"]) return { command: "npx", args: ["vite", "dev"], port: 5173, framework: "sveltekit", detected: true };
11417
+ if (deps["gatsby"]) return { command: "npx", args: ["gatsby", "develop"], port: 8e3, framework: "gatsby", detected: true };
11418
+ if (deps["remix"] || deps["@remix-run/dev"]) return { command: "npx", args: ["remix", "vite:dev"], port: 5173, framework: "remix", detected: true };
11419
+ if (deps["express"]) return { command: "node", args: ["index.js"], port: 3e3, framework: "express", detected: true };
11420
+ if (existsSync6(join6(projectDir, "manage.py"))) {
11421
+ return { command: "python", args: ["manage.py", "runserver"], port: 8e3, framework: "django", detected: true };
11422
+ }
11423
+ if (existsSync6(join6(projectDir, "requirements.txt"))) {
11424
+ const reqs = readFileSync3(join6(projectDir, "requirements.txt"), "utf-8");
11425
+ if (reqs.includes("flask")) return { command: "python", args: ["-m", "flask", "run"], port: 5e3, framework: "flask", detected: true };
11426
+ if (reqs.includes("fastapi")) return { command: "uvicorn", args: ["main:app", "--reload"], port: 8e3, framework: "fastapi", detected: true };
11427
+ }
11428
+ return { command: "", args: [], port: 3e3, framework: "unknown", detected: false };
11429
+ }
11430
+ function extractPort(cmd) {
11431
+ const portMatch = cmd.match(/(?:--port|-p)\s+(\d+)/) || cmd.match(/PORT=(\d+)/) || cmd.match(/:(\d{4,5})/);
11432
+ return portMatch ? parseInt(portMatch[1], 10) : null;
11433
+ }
11434
+ function detectFrameworkFromCmd(cmd, _pkg) {
11435
+ if (cmd.includes("next")) return "nextjs";
11436
+ if (cmd.includes("vite")) return "vite";
11437
+ if (cmd.includes("astro")) return "astro";
11438
+ if (cmd.includes("nuxt")) return "nuxt";
11439
+ if (cmd.includes("gatsby")) return "gatsby";
11440
+ if (cmd.includes("remix")) return "remix";
11441
+ if (cmd.includes("svelte")) return "sveltekit";
11442
+ if (cmd.includes("express") || cmd.includes("node server")) return "express";
11443
+ if (cmd.includes("flask")) return "flask";
11444
+ if (cmd.includes("django") || cmd.includes("manage.py")) return "django";
11445
+ if (cmd.includes("uvicorn") || cmd.includes("fastapi")) return "fastapi";
11446
+ return "unknown";
11447
+ }
11448
+ function startDevServer(projectDir, config) {
11449
+ const child = spawn2(config.command, config.args, {
11450
+ cwd: projectDir,
11451
+ stdio: "pipe",
11452
+ detached: false,
11453
+ env: { ...process.env, PORT: String(config.port) },
11454
+ shell: true
11455
+ });
11456
+ return child;
11457
+ }
11458
+ function getVibeModeConfig(enabled) {
11459
+ return `
11460
+ vibe_mode:
11461
+ enabled: ${enabled}
11462
+ auto_approve_gates: ${enabled}
11463
+ auto_generate_prd: ${enabled}
11464
+ background_testing: ${enabled}
11465
+ dev_server_autostart: ${enabled}
11466
+ `;
11467
+ }
11468
+
11371
11469
  // src/templates/configs/sandbox-policy.ts
11372
11470
  function getSandboxPolicyTemplate() {
11373
11471
  return `# FISHI Sandbox Policy
@@ -11765,6 +11863,7 @@ export {
11765
11863
  buildSandboxEnv,
11766
11864
  createBackup,
11767
11865
  detectConflicts,
11866
+ detectDevServer,
11768
11867
  detectDocker,
11769
11868
  devLeadTemplate,
11770
11869
  devopsAgentTemplate,
@@ -11822,6 +11921,7 @@ export {
11822
11921
  getTestingSkill,
11823
11922
  getTodoManagerScript,
11824
11923
  getValidateScaffoldScript,
11924
+ getVibeModeConfig,
11825
11925
  getWorktreeManagerScript,
11826
11926
  getWorktreeSetupHook,
11827
11927
  marketingAgentTemplate,
@@ -11842,6 +11942,7 @@ export {
11842
11942
  runInProcessSandbox,
11843
11943
  runInSandbox,
11844
11944
  securityAgentTemplate,
11945
+ startDevServer,
11845
11946
  testingAgentTemplate,
11846
11947
  uiuxAgentTemplate,
11847
11948
  writingAgentTemplate
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@qlucent/fishi-core",
3
- "version": "0.7.0",
3
+ "version": "0.8.0",
4
4
  "description": "Shared templates, types, and generators for the FISHI framework",
5
5
  "license": "MIT",
6
6
  "type": "module",