@sylphx/flow 2.26.0 → 2.28.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/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # @sylphx/flow
2
2
 
3
+ ## 2.28.0 (2025-12-18)
4
+
5
+ ### ✨ Features
6
+
7
+ - **commands:** add /init command to create project docs ([a07d7a3](https://github.com/SylphxAI/flow/commit/a07d7a3afd8a6448547843e081c3dde446b95c69))
8
+
9
+ ## 2.27.0 (2025-12-18)
10
+
11
+ ### ✨ Features
12
+
13
+ - **flow:** auto-create PRODUCT.md and ARCHITECTURE.md if missing ([3ae7db8](https://github.com/SylphxAI/flow/commit/3ae7db8770920422597ab073ba69b48248fd1f8b))
14
+
3
15
  ## 2.26.0 (2025-12-18)
4
16
 
5
17
  ### ✨ Features
@@ -124,6 +124,7 @@ Before accepting any approach:
124
124
  - **Before significant work**, read:
125
125
  - `PRODUCT.md` — Vision, goals, features, target users, success metrics
126
126
  - `ARCHITECTURE.md` — Tech stack, patterns, decisions, system design
127
+ - **If files don't exist**, create them with appropriate structure for the project
127
128
  - **Update immediately** when relevant changes happen
128
129
  - Product doc = WHAT and WHY. Architecture doc = HOW.
129
130
  - These docs are SSOT. Code is implementation detail.
@@ -0,0 +1,34 @@
1
+ ---
2
+ name: init
3
+ description: Initialize project docs - create PRODUCT.md and ARCHITECTURE.md
4
+ ---
5
+
6
+ # Init Project Docs
7
+
8
+ Create project documentation if missing:
9
+
10
+ 1. **Check** if `PRODUCT.md` exists in project root
11
+ - If missing → Create with structure:
12
+ - Vision / Mission
13
+ - Success Metrics (revenue, users, growth)
14
+ - Target Users
15
+ - Value Propositions
16
+ - Key Features
17
+ - Competitive Landscape
18
+ - Roadmap (Now / Next / Later)
19
+
20
+ 2. **Check** if `ARCHITECTURE.md` exists in project root
21
+ - If missing → Create with structure:
22
+ - Tech Stack (with rationale)
23
+ - System Design
24
+ - Key Patterns
25
+ - Data Models
26
+ - Integrations
27
+ - Technical Decisions
28
+ - Known Limitations
29
+
30
+ 3. **If files exist**, read them and suggest improvements based on current codebase.
31
+
32
+ **Fill in details** based on what you can learn from the codebase. Ask user for what you can't infer.
33
+
34
+ Product = WHAT and WHY. Architecture = HOW.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sylphx/flow",
3
- "version": "2.26.0",
3
+ "version": "2.28.0",
4
4
  "description": "One CLI to rule them all. Unified orchestration layer for AI coding assistants. Auto-detection, auto-installation, auto-upgrade.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -5,6 +5,9 @@
5
5
  */
6
6
 
7
7
  import chalk from 'chalk';
8
+ import { existsSync } from 'node:fs';
9
+ import fs from 'node:fs/promises';
10
+ import path from 'node:path';
8
11
  import type { Target } from '../types/target.types.js';
9
12
  import { AttachManager } from './attach-manager.js';
10
13
  import { BackupManager } from './backup-manager.js';
@@ -93,7 +96,8 @@ export class FlowExecutor {
93
96
  return { joined: true };
94
97
  }
95
98
 
96
- // First session - stash, backup, attach (all silent)
99
+ // First session - ensure project docs, stash, backup, attach (all silent)
100
+ await this.ensureProjectDocs(projectPath);
97
101
  await this.gitStashManager.stashSettingsChanges(projectPath);
98
102
  const backup = await this.backupManager.createBackup(projectPath, projectHash, target);
99
103
 
@@ -259,6 +263,28 @@ export class FlowExecutor {
259
263
  }
260
264
  }
261
265
 
266
+ /**
267
+ * Ensure PRODUCT.md and ARCHITECTURE.md exist in project root
268
+ * Creates from templates if missing
269
+ */
270
+ private async ensureProjectDocs(projectPath: string): Promise<void> {
271
+ const templatesDir = this.templateLoader.getAssetsDir();
272
+ const templates = [
273
+ { name: 'PRODUCT.md', template: path.join(templatesDir, 'templates', 'PRODUCT.md') },
274
+ { name: 'ARCHITECTURE.md', template: path.join(templatesDir, 'templates', 'ARCHITECTURE.md') },
275
+ ];
276
+
277
+ for (const { name, template } of templates) {
278
+ const targetPath = path.join(projectPath, name);
279
+
280
+ // Only create if file doesn't exist and template exists
281
+ if (!existsSync(targetPath) && existsSync(template)) {
282
+ const content = await fs.readFile(template, 'utf-8');
283
+ await fs.writeFile(targetPath, content, 'utf-8');
284
+ }
285
+ }
286
+ }
287
+
262
288
  /**
263
289
  * Cleanup after execution (silent)
264
290
  */