@qlucent/fishi-core 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.
Files changed (3) hide show
  1. package/dist/index.d.ts +458 -0
  2. package/dist/index.js +10716 -0
  3. package/package.json +36 -0
@@ -0,0 +1,458 @@
1
+ type ProjectType = 'greenfield' | 'brownfield' | 'hybrid';
2
+ type CostMode = 'performance' | 'balanced' | 'economy';
3
+ type ModelTier = 'opus' | 'sonnet' | 'haiku';
4
+ type TaskStatus = 'backlog' | 'ready' | 'in_progress' | 'review' | 'done' | 'blocked';
5
+ type GateStatus = 'pending' | 'approved' | 'rejected' | 'skipped';
6
+ type AgentRole = 'master' | 'coordinator' | 'worker';
7
+ interface FishiConfig {
8
+ version: string;
9
+ project: ProjectConfig;
10
+ execution: ExecutionConfig;
11
+ cost_mode: CostMode;
12
+ model_routing: ModelRoutingConfig;
13
+ git: GitConfig;
14
+ gates: GateConfig;
15
+ taskboard: TaskboardConfig;
16
+ state: StateConfig;
17
+ dynamic_agents: DynamicAgentConfig;
18
+ mcp: McpConfig;
19
+ plugins: string[];
20
+ }
21
+ interface ProjectConfig {
22
+ name: string;
23
+ description: string;
24
+ type: ProjectType;
25
+ language?: string;
26
+ framework?: string;
27
+ }
28
+ interface ExecutionConfig {
29
+ mode: 'cli' | 'headless' | 'api';
30
+ parallel: boolean;
31
+ max_parallel: number;
32
+ }
33
+ interface ModelRoutingConfig {
34
+ opus: string[];
35
+ sonnet: string[];
36
+ haiku: string[];
37
+ }
38
+ interface GitConfig {
39
+ strategy: 'auto' | 'single-branch' | 'milestone-branch' | 'worktree-per-agent';
40
+ main_branch: string;
41
+ dev_branch: string;
42
+ worktree_dir: string;
43
+ auto_commit: boolean;
44
+ commit_prefix: boolean;
45
+ }
46
+ interface GateConfig {
47
+ enabled: boolean;
48
+ gate_points: string[];
49
+ }
50
+ interface TaskboardConfig {
51
+ enabled: boolean;
52
+ auto_update: boolean;
53
+ sprint_duration: 'auto' | '1week' | '2weeks';
54
+ }
55
+ interface StateConfig {
56
+ checkpoint_on_stop: boolean;
57
+ max_checkpoints: number;
58
+ compress_after_sprint: boolean;
59
+ }
60
+ interface DynamicAgentConfig {
61
+ enabled: boolean;
62
+ require_approval: boolean;
63
+ }
64
+ interface McpConfig {
65
+ auto_discover: boolean;
66
+ core: string[];
67
+ project: McpServerConfig[];
68
+ agent_access: Record<string, string[]>;
69
+ }
70
+ interface McpServerConfig {
71
+ name: string;
72
+ env?: Record<string, string>;
73
+ }
74
+ interface AgentDefinition {
75
+ name: string;
76
+ description: string;
77
+ role: AgentRole;
78
+ tools: string[];
79
+ model: ModelTier;
80
+ isolation?: 'worktree';
81
+ manages?: string[];
82
+ reports_to?: string;
83
+ }
84
+ interface DetectionResult {
85
+ type: ProjectType;
86
+ checks: DetectionCheck[];
87
+ confidence: number;
88
+ }
89
+ interface DetectionCheck {
90
+ check: string;
91
+ passed: boolean;
92
+ evidence?: string;
93
+ }
94
+ interface InitOptions {
95
+ description?: string;
96
+ interactive: boolean;
97
+ costMode: CostMode;
98
+ language?: string;
99
+ framework?: string;
100
+ }
101
+
102
+ interface TemplateContext {
103
+ projectName: string;
104
+ projectDescription: string;
105
+ projectType: string;
106
+ language?: string;
107
+ framework?: string;
108
+ costMode: string;
109
+ timestamp: string;
110
+ }
111
+ interface AgentTemplate {
112
+ filename: string;
113
+ content: string;
114
+ directory: 'agents' | 'agents/coordinators';
115
+ }
116
+ interface SkillTemplate {
117
+ directory: string;
118
+ files: Record<string, string>;
119
+ }
120
+ interface HookTemplate {
121
+ filename: string;
122
+ content: string;
123
+ }
124
+ interface CommandTemplate {
125
+ filename: string;
126
+ content: string;
127
+ }
128
+
129
+ /**
130
+ * Master Orchestrator Agent Template
131
+ *
132
+ * The top-level agent in the FISHI hierarchy. Runs on Opus.
133
+ * Responsible for phase transitions, gate management, coordinator delegation,
134
+ * and project-level decision-making. Does NOT perform operational work directly.
135
+ */
136
+ declare function getMasterOrchestratorTemplate(): string;
137
+
138
+ declare function planningLeadTemplate(ctx: TemplateContext): string;
139
+
140
+ declare function devLeadTemplate(ctx: TemplateContext): string;
141
+
142
+ declare function qualityLeadTemplate(ctx: TemplateContext): string;
143
+
144
+ declare function opsLeadTemplate(ctx: TemplateContext): string;
145
+
146
+ declare function researchAgentTemplate(ctx: TemplateContext): string;
147
+
148
+ declare function planningAgentTemplate(ctx: TemplateContext): string;
149
+
150
+ declare function architectAgentTemplate(ctx: TemplateContext): string;
151
+
152
+ declare function backendAgentTemplate(ctx: TemplateContext): string;
153
+
154
+ declare function frontendAgentTemplate(ctx: TemplateContext): string;
155
+
156
+ declare function uiuxAgentTemplate(ctx: TemplateContext): string;
157
+
158
+ declare function fullstackAgentTemplate(ctx: TemplateContext): string;
159
+
160
+ declare function devopsAgentTemplate(ctx: TemplateContext): string;
161
+
162
+ declare function testingAgentTemplate(ctx: TemplateContext): string;
163
+
164
+ declare function securityAgentTemplate(ctx: TemplateContext): string;
165
+
166
+ declare function docsAgentTemplate(ctx: TemplateContext): string;
167
+
168
+ declare function writingAgentTemplate(ctx: TemplateContext): string;
169
+
170
+ declare function marketingAgentTemplate(ctx: TemplateContext): string;
171
+
172
+ declare function getBrainstormingSkill(): string;
173
+
174
+ declare function getBrownfieldAnalysisSkill(): string;
175
+
176
+ declare function getTaskboardOpsSkill(): string;
177
+
178
+ declare function getCodeGenSkill(): string;
179
+
180
+ declare function getDebuggingSkill(): string;
181
+
182
+ declare function getApiDesignSkill(): string;
183
+
184
+ declare function getTestingSkill(): string;
185
+
186
+ declare function getDeploymentSkill(): string;
187
+
188
+ declare function getPrdSkill(): string;
189
+
190
+ declare function getBrownfieldDiscoverySkill(): string;
191
+
192
+ declare function getAdaptiveTaskGraphSkill(): string;
193
+
194
+ /**
195
+ * Documentation Skill
196
+ *
197
+ * Instructs agents on documentation standards across all FISHI phases.
198
+ * Documentation is mandatory at every stage — no phase gate passes without proper docs.
199
+ */
200
+ declare function getDocumentationSkill(): string;
201
+
202
+ /**
203
+ * Session Start Hook Template
204
+ *
205
+ * Generates an .mjs hook that fires on SessionStart. It reads project state,
206
+ * the latest checkpoint, project context memory, and the taskboard to output
207
+ * a structured resume context summary to stdout for Claude Code to capture.
208
+ */
209
+ declare function getSessionStartHook(): string;
210
+
211
+ /**
212
+ * Auto-Checkpoint Hook Template
213
+ *
214
+ * Generates an .mjs hook that fires on Stop. It reads project state, taskboard
215
+ * counts, and active worktrees to create a checkpoint file, then updates
216
+ * project.yaml with the latest checkpoint reference. Keeps max 50 checkpoints.
217
+ */
218
+ declare function getAutoCheckpointHook(): string;
219
+
220
+ /**
221
+ * Agent Complete Hook Template
222
+ *
223
+ * Generates an .mjs hook that fires on SubagentStop. It reads the tool result
224
+ * from stdin, parses agent output for STATUS/FILES_CHANGED/SUMMARY fields,
225
+ * updates the taskboard (moves tasks from In Progress to Review), and logs
226
+ * the completion to an agent-specific log file.
227
+ */
228
+ declare function getAgentCompleteHook(): string;
229
+
230
+ /**
231
+ * Post-Edit Hook Template
232
+ *
233
+ * Generates an .mjs hook that fires on PostToolUse for Write|Edit.
234
+ * It reads the tool result from stdin to get the file path, then runs
235
+ * eslint --fix if available. Only acts on code files and skips excluded dirs.
236
+ * Never blocks or fails — always exits 0.
237
+ */
238
+ declare function getPostEditHook(): string;
239
+
240
+ /**
241
+ * Safety Check Hook Template
242
+ *
243
+ * Generates an .mjs hook that fires on PreToolUse for Bash.
244
+ * It reads the tool input JSON from stdin to get the command field,
245
+ * checks against dangerous patterns, and exits 2 to block or 0 to allow.
246
+ */
247
+ declare function getSafetyCheckHook(): string;
248
+
249
+ /**
250
+ * Worktree Setup Hook Template
251
+ *
252
+ * Generates an .mjs hook that fires on worktree creation. It copies
253
+ * environment files (.env, .env.local) to the new worktree, detects the
254
+ * package manager from lock files, and runs dependency installation with
255
+ * a 60-second timeout.
256
+ */
257
+ declare function getWorktreeSetupHook(): string;
258
+
259
+ /**
260
+ * Taskboard Update Hook Template
261
+ *
262
+ * Generates an .mjs hook that fires after task state changes. It reads the
263
+ * taskboard, counts tasks per column, finds the current sprint file, and
264
+ * updates the sprint burndown with new counts.
265
+ */
266
+ declare function getTaskboardUpdateHook(): string;
267
+
268
+ /**
269
+ * Worktree Manager Script Template
270
+ *
271
+ * Generates an .mjs CLI utility that manages git worktree lifecycle for
272
+ * agent tasks. Zero dependencies — Node.js built-ins only.
273
+ *
274
+ * Commands: create, status, review, merge, cleanup
275
+ */
276
+ declare function getWorktreeManagerScript(): string;
277
+
278
+ /**
279
+ * Gate Manager Script
280
+ *
281
+ * CLI utility for managing approval gates. Agents and coordinators invoke this
282
+ * to create, check, and update gate status.
283
+ *
284
+ * Zero dependencies — uses only Node.js built-ins.
285
+ */
286
+ declare function getGateManagerScript(): string;
287
+
288
+ /**
289
+ * Validate Scaffold Hook Template
290
+ *
291
+ * Generates an .mjs script that validates the entire FISHI scaffold is
292
+ * internally consistent: file existence, YAML frontmatter, cross-references,
293
+ * pipeline consistency, and permission validation.
294
+ * Zero dependencies: uses only Node.js built-ins.
295
+ */
296
+ declare function getValidateScaffoldScript(): string;
297
+
298
+ /**
299
+ * Phase Runner Script
300
+ *
301
+ * CLI utility that orchestrates phase transitions programmatically.
302
+ * Used by Master Agent and /fishi-init command to drive the pipeline.
303
+ * Also serves as a dry-run validator for the full pipeline.
304
+ *
305
+ * Zero dependencies — uses only Node.js built-ins.
306
+ */
307
+ declare function getPhaseRunnerScript(): string;
308
+
309
+ /**
310
+ * TODO Manager Script
311
+ *
312
+ * Returns a .mjs script (zero dependencies, Node.js built-ins only)
313
+ * that manages agent-level TODO lists stored at `.fishi/todos/{agent-name}.md`.
314
+ */
315
+ declare function getTodoManagerScript(): string;
316
+
317
+ /**
318
+ * Memory Manager Script
319
+ *
320
+ * CLI utility for managing persistent agent memory across sessions.
321
+ * Each agent gets a personal memory file at `.fishi/memory/agents/{agent-name}.md`
322
+ * with key-value entries stored as markdown H2 sections.
323
+ *
324
+ * Zero dependencies — uses only Node.js built-ins.
325
+ */
326
+ declare function getMemoryManagerScript(): string;
327
+
328
+ /**
329
+ * Learnings Manager Script
330
+ *
331
+ * CLI utility for capturing mistakes, fixes, and best practices.
332
+ * Stores learnings locally (per-project) and globally (cross-project).
333
+ *
334
+ * Zero dependencies — uses only Node.js built-ins.
335
+ */
336
+ declare function getLearningsManagerScript(): string;
337
+
338
+ /**
339
+ * Documentation Checker Script
340
+ *
341
+ * CLI utility for validating that required documentation exists for each
342
+ * FISHI phase before a gate can be approved.
343
+ *
344
+ * Zero dependencies — uses only Node.js built-ins.
345
+ */
346
+ declare function getDocCheckerScript(): string;
347
+
348
+ declare function getInitCommand(): string;
349
+
350
+ declare function getStatusCommand(): string;
351
+
352
+ declare function getResumeCommand(): string;
353
+
354
+ declare function getGateCommand(): string;
355
+
356
+ declare function getBoardCommand(): string;
357
+
358
+ declare function getSprintCommand(): string;
359
+
360
+ declare function getResetCommand(): string;
361
+
362
+ declare function getPrdCommand(): string;
363
+
364
+ interface FishiYamlOptions {
365
+ projectName: string;
366
+ projectDescription: string;
367
+ projectType: ProjectType;
368
+ costMode: CostMode;
369
+ language?: string;
370
+ framework?: string;
371
+ }
372
+ declare function getFishiYamlTemplate(options: FishiYamlOptions): string;
373
+
374
+ declare function getSettingsJsonTemplate(): string;
375
+
376
+ interface BrownfieldAnalysisData {
377
+ language: string | null;
378
+ framework: string | null;
379
+ testFramework: string | null;
380
+ packageManager: string | null;
381
+ linter: string | null;
382
+ formatter: string | null;
383
+ cssFramework: string | null;
384
+ orm: string | null;
385
+ database: string | null;
386
+ authProvider: string | null;
387
+ apiStyle: string | null;
388
+ monorepo: boolean;
389
+ conventions: string[];
390
+ codePatterns: Array<{
391
+ name: string;
392
+ evidence: string;
393
+ confidence: number;
394
+ }>;
395
+ fileStats: {
396
+ totalFiles: number;
397
+ codeFiles: number;
398
+ testFiles: number;
399
+ };
400
+ }
401
+ interface ClaudeMdOptions {
402
+ projectName: string;
403
+ projectDescription: string;
404
+ projectType: ProjectType;
405
+ language?: string;
406
+ framework?: string;
407
+ brownfieldAnalysis?: BrownfieldAnalysisData;
408
+ }
409
+ declare function getClaudeMdTemplate(options: ClaudeMdOptions): string;
410
+
411
+ declare function getMcpJsonTemplate(): string;
412
+
413
+ interface ProjectYamlOptions {
414
+ projectName: string;
415
+ projectDescription: string;
416
+ projectType: ProjectType;
417
+ }
418
+ declare function getProjectYamlTemplate(options: ProjectYamlOptions): string;
419
+
420
+ declare function getAgentRegistryTemplate(): string;
421
+
422
+ declare function getGitignoreAdditions(): string;
423
+
424
+ declare function getModelRoutingReference(): string;
425
+
426
+ /**
427
+ * Agent Factory Template
428
+ *
429
+ * Returns a markdown template with {{PLACEHOLDERS}} for generating
430
+ * specialized worker agent configuration files at runtime.
431
+ * Master and Coordinators fill in placeholders when creating dynamic agents.
432
+ */
433
+ declare function getAgentFactoryTemplate(): string;
434
+
435
+ /**
436
+ * Coordinator Factory Template
437
+ *
438
+ * Returns a markdown template with {{PLACEHOLDERS}} for generating
439
+ * coordinator agent configuration files at runtime.
440
+ * Master Agent fills in placeholders when creating dynamic coordinators.
441
+ */
442
+ declare function getCoordinatorFactoryTemplate(): string;
443
+
444
+ interface ScaffoldOptions extends InitOptions {
445
+ projectName: string;
446
+ projectType: ProjectType;
447
+ brownfieldAnalysis?: BrownfieldAnalysisData;
448
+ }
449
+ interface ScaffoldResult {
450
+ agentCount: number;
451
+ skillCount: number;
452
+ commandCount: number;
453
+ hookCount: number;
454
+ filesCreated: number;
455
+ }
456
+ declare function generateScaffold(targetDir: string, options: ScaffoldOptions): Promise<ScaffoldResult>;
457
+
458
+ export { type AgentDefinition, type AgentRole, type AgentTemplate, type BrownfieldAnalysisData, type ClaudeMdOptions, type CommandTemplate, type CostMode, type DetectionCheck, type DetectionResult, type DynamicAgentConfig, type ExecutionConfig, type FishiConfig, type FishiYamlOptions, type GateConfig, type GateStatus, type GitConfig, type HookTemplate, type InitOptions, type McpConfig, type McpServerConfig, type ModelRoutingConfig, type ModelTier, type ProjectConfig, type ProjectType, type ProjectYamlOptions, type ScaffoldOptions, type ScaffoldResult, type SkillTemplate, type StateConfig, type TaskStatus, type TaskboardConfig, type TemplateContext, architectAgentTemplate, backendAgentTemplate, devLeadTemplate, devopsAgentTemplate, docsAgentTemplate, frontendAgentTemplate, fullstackAgentTemplate, generateScaffold, getAdaptiveTaskGraphSkill, getAgentCompleteHook, getAgentFactoryTemplate, getAgentRegistryTemplate, getApiDesignSkill, getAutoCheckpointHook, getBoardCommand, getBrainstormingSkill, getBrownfieldAnalysisSkill, getBrownfieldDiscoverySkill, getClaudeMdTemplate, getCodeGenSkill, getCoordinatorFactoryTemplate, getDebuggingSkill, getDeploymentSkill, getDocCheckerScript, getDocumentationSkill, getFishiYamlTemplate, getGateCommand, getGateManagerScript, getGitignoreAdditions, getInitCommand, getLearningsManagerScript, getMasterOrchestratorTemplate, getMcpJsonTemplate, getMemoryManagerScript, getModelRoutingReference, getPhaseRunnerScript, getPostEditHook, getPrdCommand, getPrdSkill, getProjectYamlTemplate, getResetCommand, getResumeCommand, getSafetyCheckHook, getSessionStartHook, getSettingsJsonTemplate, getSprintCommand, getStatusCommand, getTaskboardOpsSkill, getTaskboardUpdateHook, getTestingSkill, getTodoManagerScript, getValidateScaffoldScript, getWorktreeManagerScript, getWorktreeSetupHook, marketingAgentTemplate, opsLeadTemplate, planningAgentTemplate, planningLeadTemplate, qualityLeadTemplate, researchAgentTemplate, securityAgentTemplate, testingAgentTemplate, uiuxAgentTemplate, writingAgentTemplate };