@flydocs/cli 0.6.0-alpha.2 → 0.6.0-alpha.21

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 (148) hide show
  1. package/dist/cli.js +705 -393
  2. package/package.json +1 -1
  3. package/template/.claude/CLAUDE.md +62 -63
  4. package/template/.claude/agents/implementation-agent.md +1 -1
  5. package/template/.claude/agents/pm-agent.md +1 -1
  6. package/template/.claude/commands/activate.md +1 -1
  7. package/template/.claude/commands/attach.md +1 -1
  8. package/template/.claude/commands/block.md +2 -2
  9. package/template/.claude/commands/capture.md +1 -1
  10. package/template/.claude/commands/close.md +1 -1
  11. package/template/.claude/commands/flydocs-setup.md +387 -74
  12. package/template/.claude/commands/flydocs-upgrade.md +48 -37
  13. package/template/.claude/commands/implement.md +1 -1
  14. package/template/.claude/commands/knowledge.md +61 -0
  15. package/template/.claude/commands/new-project.md +1 -1
  16. package/template/.claude/commands/onboard.md +275 -0
  17. package/template/.claude/commands/project-update.md +1 -1
  18. package/template/.claude/commands/refine.md +1 -1
  19. package/template/.claude/commands/review.md +1 -1
  20. package/template/.claude/commands/start-session.md +1 -1
  21. package/template/.claude/commands/status.md +1 -1
  22. package/template/.claude/commands/validate.md +1 -1
  23. package/template/.claude/commands/wrap-session.md +1 -1
  24. package/template/.claude/hooks/auto-approve.py +132 -0
  25. package/template/.claude/hooks/post-pr-check.py +108 -0
  26. package/template/.claude/hooks/post-transition-check.py +94 -0
  27. package/template/.claude/hooks/prompt-submit.py +513 -0
  28. package/template/.claude/hooks/session-start.py +146 -0
  29. package/template/.claude/hooks/stop-gate.py +109 -0
  30. package/template/.claude/settings.json +41 -4
  31. package/template/.claude/skills/README.md +23 -25
  32. package/template/.claude/skills/flydocs-workflow/SKILL.md +134 -42
  33. package/template/.claude/skills/flydocs-workflow/cursor-rule.mdc +9 -8
  34. package/template/.claude/skills/flydocs-workflow/reference/comment-templates.md +1 -0
  35. package/template/.claude/skills/flydocs-workflow/reference/golden-rules.md +28 -17
  36. package/template/.claude/skills/flydocs-workflow/reference/graph-schema.md +116 -0
  37. package/template/.claude/skills/flydocs-workflow/reference/pr-workflow.md +120 -0
  38. package/template/.claude/skills/flydocs-workflow/reference/priority-estimates.md +37 -15
  39. package/template/.claude/skills/flydocs-workflow/reference/service-descriptor-schema.md +251 -0
  40. package/template/.claude/skills/flydocs-workflow/reference/status-workflow.md +26 -26
  41. package/template/.claude/skills/flydocs-workflow/scripts/_local/__init__.py +0 -0
  42. package/template/.claude/skills/{flydocs-local/scripts/flydocs_api.py → flydocs-workflow/scripts/_local/file_store.py} +137 -47
  43. package/template/.claude/skills/flydocs-workflow/scripts/flydocs_api.py +693 -0
  44. package/template/{.flydocs → .claude/skills/flydocs-workflow}/scripts/generate_manifest.py +4 -4
  45. package/template/.claude/skills/{flydocs-context-graph → flydocs-workflow}/scripts/graph_build.py +132 -1
  46. package/template/.claude/skills/{flydocs-context-graph → flydocs-workflow}/scripts/graph_query.py +18 -5
  47. package/template/.claude/skills/{flydocs-context-graph → flydocs-workflow}/scripts/graph_session.py +1 -10
  48. package/template/.claude/skills/{flydocs-context-graph → flydocs-workflow}/scripts/graph_update.py +4 -4
  49. package/template/.claude/skills/{flydocs-context-graph → flydocs-workflow}/scripts/graph_utils.py +2 -1
  50. package/template/.claude/skills/flydocs-workflow/scripts/issues.py +489 -0
  51. package/template/.claude/skills/flydocs-workflow/scripts/projects.py +144 -0
  52. package/template/.claude/skills/flydocs-workflow/scripts/pull_services.py +128 -0
  53. package/template/.claude/skills/flydocs-workflow/scripts/push_service.py +132 -0
  54. package/template/.claude/skills/flydocs-workflow/scripts/session.py +54 -0
  55. package/template/.claude/skills/flydocs-workflow/scripts/workspace.py +860 -0
  56. package/template/.claude/skills/flydocs-workflow/session.md +63 -25
  57. package/template/.claude/skills/flydocs-workflow/stages/activate.md +18 -7
  58. package/template/.claude/skills/flydocs-workflow/stages/capture.md +10 -5
  59. package/template/.claude/skills/flydocs-workflow/stages/close.md +4 -3
  60. package/template/.claude/skills/flydocs-workflow/stages/implement.md +33 -9
  61. package/template/.claude/skills/flydocs-workflow/stages/refine.md +22 -6
  62. package/template/.claude/skills/flydocs-workflow/stages/review.md +16 -4
  63. package/template/.claude/skills/flydocs-workflow/stages/validate.md +3 -1
  64. package/template/.claude/skills/flydocs-workflow/templates/pr/default.md +33 -0
  65. package/template/.cursor/agents/implementation-agent.md +1 -1
  66. package/template/.cursor/agents/pm-agent.md +2 -2
  67. package/template/.cursor/hooks.json +10 -3
  68. package/template/.env.example +6 -6
  69. package/template/.flydocs/config.json +5 -18
  70. package/template/.flydocs/templates/README.md +13 -14
  71. package/template/.flydocs/templates/quick-capture.md +4 -8
  72. package/template/.flydocs/version +1 -1
  73. package/template/AGENTS.md +39 -32
  74. package/template/CHANGELOG.md +39 -0
  75. package/template/flydocs/README.md +1 -3
  76. package/template/flydocs/context/project.md +6 -3
  77. package/template/flydocs/design-system/README.md +3 -3
  78. package/template/flydocs/knowledge/INDEX.md +38 -53
  79. package/template/flydocs/knowledge/README.md +60 -9
  80. package/template/flydocs/knowledge/templates/decision.md +47 -0
  81. package/template/flydocs/knowledge/templates/feature.md +35 -0
  82. package/template/flydocs/knowledge/templates/note.md +25 -0
  83. package/template/manifest.json +24 -20
  84. package/template/.claude/skills/flydocs-cloud/SKILL.md +0 -111
  85. package/template/.claude/skills/flydocs-cloud/cursor-rule.mdc +0 -50
  86. package/template/.claude/skills/flydocs-cloud/scripts/assign.py +0 -22
  87. package/template/.claude/skills/flydocs-cloud/scripts/assign_cycle.py +0 -28
  88. package/template/.claude/skills/flydocs-cloud/scripts/assign_milestone.py +0 -22
  89. package/template/.claude/skills/flydocs-cloud/scripts/comment.py +0 -29
  90. package/template/.claude/skills/flydocs-cloud/scripts/create_issue.py +0 -63
  91. package/template/.claude/skills/flydocs-cloud/scripts/create_milestone.py +0 -35
  92. package/template/.claude/skills/flydocs-cloud/scripts/create_project.py +0 -33
  93. package/template/.claude/skills/flydocs-cloud/scripts/create_team.py +0 -39
  94. package/template/.claude/skills/flydocs-cloud/scripts/estimate.py +0 -29
  95. package/template/.claude/skills/flydocs-cloud/scripts/flydocs_api.py +0 -210
  96. package/template/.claude/skills/flydocs-cloud/scripts/get_issue.py +0 -24
  97. package/template/.claude/skills/flydocs-cloud/scripts/link.py +0 -28
  98. package/template/.claude/skills/flydocs-cloud/scripts/list_cycles.py +0 -28
  99. package/template/.claude/skills/flydocs-cloud/scripts/list_issues.py +0 -44
  100. package/template/.claude/skills/flydocs-cloud/scripts/list_labels.py +0 -19
  101. package/template/.claude/skills/flydocs-cloud/scripts/list_milestones.py +0 -28
  102. package/template/.claude/skills/flydocs-cloud/scripts/list_projects.py +0 -31
  103. package/template/.claude/skills/flydocs-cloud/scripts/list_teams.py +0 -19
  104. package/template/.claude/skills/flydocs-cloud/scripts/priority.py +0 -29
  105. package/template/.claude/skills/flydocs-cloud/scripts/project_update.py +0 -45
  106. package/template/.claude/skills/flydocs-cloud/scripts/set_labels.py +0 -68
  107. package/template/.claude/skills/flydocs-cloud/scripts/set_team.py +0 -41
  108. package/template/.claude/skills/flydocs-cloud/scripts/transition.py +0 -26
  109. package/template/.claude/skills/flydocs-cloud/scripts/update_description.py +0 -36
  110. package/template/.claude/skills/flydocs-cloud/scripts/update_issue.py +0 -82
  111. package/template/.claude/skills/flydocs-context-graph/SKILL.md +0 -87
  112. package/template/.claude/skills/flydocs-context-graph/schema.md +0 -78
  113. package/template/.claude/skills/flydocs-context-graph/scripts/graph_context.py +0 -338
  114. package/template/.claude/skills/flydocs-context7/SKILL.md +0 -105
  115. package/template/.claude/skills/flydocs-context7/cursor-rule.mdc +0 -49
  116. package/template/.claude/skills/flydocs-context7/scripts/context7.py +0 -293
  117. package/template/.claude/skills/flydocs-estimates/SKILL.md +0 -384
  118. package/template/.claude/skills/flydocs-figma/SKILL.md +0 -377
  119. package/template/.claude/skills/flydocs-figma/references/PROMPTING.md +0 -108
  120. package/template/.claude/skills/flydocs-figma/references/TROUBLESHOOTING.md +0 -112
  121. package/template/.claude/skills/flydocs-local/SKILL.md +0 -103
  122. package/template/.claude/skills/flydocs-local/cursor-rule.mdc +0 -43
  123. package/template/.claude/skills/flydocs-local/scripts/assign.py +0 -20
  124. package/template/.claude/skills/flydocs-local/scripts/comment.py +0 -27
  125. package/template/.claude/skills/flydocs-local/scripts/create_issue.py +0 -44
  126. package/template/.claude/skills/flydocs-local/scripts/estimate.py +0 -37
  127. package/template/.claude/skills/flydocs-local/scripts/get_issue.py +0 -20
  128. package/template/.claude/skills/flydocs-local/scripts/link.py +0 -41
  129. package/template/.claude/skills/flydocs-local/scripts/list_issues.py +0 -34
  130. package/template/.claude/skills/flydocs-local/scripts/priority.py +0 -37
  131. package/template/.claude/skills/flydocs-local/scripts/project_update.py +0 -67
  132. package/template/.claude/skills/flydocs-local/scripts/status_summary.py +0 -16
  133. package/template/.claude/skills/flydocs-local/scripts/transition.py +0 -24
  134. package/template/.claude/skills/flydocs-local/scripts/update_description.py +0 -35
  135. package/template/.claude/skills/flydocs-local/scripts/update_issue.py +0 -84
  136. package/template/.flydocs/hooks/auto-approve.py +0 -71
  137. package/template/.flydocs/hooks/prompt-submit.py +0 -277
  138. package/template/.flydocs/scripts/skill_manager.py +0 -541
  139. package/template/.flydocs/templates/bug.md +0 -166
  140. package/template/.flydocs/templates/chore.md +0 -110
  141. package/template/.flydocs/templates/feature.md +0 -173
  142. package/template/.flydocs/templates/idea.md +0 -122
  143. /package/template/{.flydocs → .claude}/hooks/post-edit.py +0 -0
  144. /package/template/.claude/skills/{flydocs-estimates/references → flydocs-workflow/reference}/provider-costs.md +0 -0
  145. /package/template/.claude/skills/flydocs-workflow/templates/{bug.md → issues/bug.md} +0 -0
  146. /package/template/.claude/skills/flydocs-workflow/templates/{chore.md → issues/chore.md} +0 -0
  147. /package/template/.claude/skills/flydocs-workflow/templates/{feature.md → issues/feature.md} +0 -0
  148. /package/template/.claude/skills/flydocs-workflow/templates/{idea.md → issues/idea.md} +0 -0
@@ -0,0 +1,116 @@
1
+ # Context Graph Schema
2
+
3
+ Reference for the graph JSON structure stored at `flydocs/context/graph.json`.
4
+
5
+ ## Top-Level Structure
6
+
7
+ ```json
8
+ {
9
+ "version": 1,
10
+ "updated": "ISO-8601 timestamp",
11
+ "nodes": { "<id>": { ... } },
12
+ "edges": [ { ... } ]
13
+ }
14
+ ```
15
+
16
+ ## Node Schema
17
+
18
+ ```json
19
+ {
20
+ "type": "skill | decision | issue | module | session | concept",
21
+ "label": "Human-readable name",
22
+ "path": "Relative file path (optional)",
23
+ "status": "Node-specific status (optional)",
24
+ "date": "ISO date for temporal nodes (optional)",
25
+ "tier": "Skill tier: behavioral | mechanism | premium (optional)",
26
+ "manual": true
27
+ }
28
+ ```
29
+
30
+ **ID conventions:**
31
+
32
+ | Type | Pattern | Example |
33
+ | -------- | --------------------------- | -------------------------------- |
34
+ | skill | `skill:{directory-name}` | `skill:typescript-strict` |
35
+ | decision | `decision:{3-digit-number}` | `decision:001` |
36
+ | issue | `issue:{identifier}` | `issue:FLY-56` |
37
+ | module | `module:{kebab-name}` | `module:install-script` |
38
+ | session | `session:{YYYY-MM-DD-seq}` | `session:2026-02-03-a` |
39
+ | concept | `concept:{kebab-name}` | `concept:progressive-disclosure` |
40
+ | repo | `repo:{owner/name}` | `repo:plastrlab/flydocs-app` |
41
+
42
+ ## Edge Schema
43
+
44
+ ```json
45
+ {
46
+ "from": "source node ID",
47
+ "to": "target node ID",
48
+ "rel": "RELATIONSHIP_TYPE",
49
+ "weight": 0.0-1.0,
50
+ "manual": true
51
+ }
52
+ ```
53
+
54
+ **Weight guidelines:**
55
+
56
+ | Weight | Meaning |
57
+ | ------- | --------------------------- |
58
+ | 1.0 | Direct, strong relationship |
59
+ | 0.7-0.9 | Strong but indirect |
60
+ | 0.4-0.6 | Moderate association |
61
+ | 0.1-0.3 | Weak or tangential |
62
+
63
+ **Edges with `"manual": true`** are preserved when `graph_build.py` rebuilds
64
+ the graph from sources. Auto-derived edges are regenerated on each build.
65
+
66
+ ## Relationship Types
67
+
68
+ | Relationship | Direction | Example |
69
+ | -------------- | ------------------------------ | ----------------------------------------- |
70
+ | `EXTENDS` | A extends B | ADR-004 extends ADR-001 |
71
+ | `IMPLEMENTS` | A implements B | Issue implements a decision |
72
+ | `DELEGATES_TO` | A delegates to B | Workflow delegates to mechanism |
73
+ | `PRECEDES` | A should load before B | typescript-strict precedes implementation |
74
+ | `MODIFIES` | A modifies B | Issue modifies a module |
75
+ | `WORKED_ON` | A worked on B | Session worked on an issue |
76
+ | `PRODUCED` | A produced B | Session produced a decision |
77
+ | `RELATES_TO` | A relates to B | General association |
78
+ | `SUPERSEDES` | A supersedes B | New decision replaces old |
79
+ | `BLOCKS` | A blocks B | Issue blocks another issue |
80
+ | `PROVIDES` | A exposes interface B consumes | Repo provides REST API to sibling |
81
+ | `CONSUMES` | A depends on B's interface | Repo consumes another's API |
82
+
83
+ ### Cross-Repo Edge Properties
84
+
85
+ Edges of type `PROVIDES` and `CONSUMES` carry additional properties:
86
+
87
+ ```json
88
+ {
89
+ "from": "repo:plastrlab/flydocs-core",
90
+ "to": "repo:plastrlab/flydocs-app",
91
+ "rel": "PROVIDES",
92
+ "weight": 1.0,
93
+ "interface": "REST API /api/relay/*",
94
+ "description": "Core CLI pushes config and descriptors to relay endpoints"
95
+ }
96
+ ```
97
+
98
+ | Property | Type | Description |
99
+ | ------------- | ------ | ------------------------------------------------------ |
100
+ | `interface` | string | What is exposed or consumed (endpoint, event, package) |
101
+ | `description` | string | Brief context about the relationship |
102
+
103
+ ## Repo Node Schema
104
+
105
+ Repo nodes are derived from `flydocs/context/service.json` by `graph_build.py`.
106
+ See `service-descriptor-schema.md` for the full ServiceDescriptor interface.
107
+
108
+ ```json
109
+ {
110
+ "type": "repo",
111
+ "label": "flydocs-app",
112
+ "path": "flydocs/context/service.json",
113
+ "purpose": "Web dashboard and relay API for FlyDocs cloud tier",
114
+ "stack": ["next", "convex", "typescript"]
115
+ }
116
+ ```
@@ -0,0 +1,120 @@
1
+ # PR & Git Workflow
2
+
3
+ ## Branch Naming
4
+
5
+ Format: `<type>/<ref>-<slug>`
6
+
7
+ | Type | When |
8
+ | --------- | -------------------------------------- |
9
+ | `feature` | New functionality |
10
+ | `fix` | Bug fixes |
11
+ | `chore` | Maintenance, refactoring, dependencies |
12
+ | `docs` | Documentation only |
13
+
14
+ Examples:
15
+
16
+ - `feature/FLY-255-knowledge-capture`
17
+ - `fix/FLY-301-login-timeout`
18
+ - `chore/FLY-290-upgrade-deps`
19
+
20
+ Keep the slug short (2-4 words, kebab-case). Include the issue reference.
21
+
22
+ ## Commit Messages
23
+
24
+ Format: `<type>: <description> (<ref>)`
25
+
26
+ - Lead with what changed, not how
27
+ - Use imperative mood ("Add", not "Added")
28
+ - Keep the first line under 72 characters
29
+ - Add a body for non-obvious changes
30
+
31
+ Examples:
32
+
33
+ ```
34
+ feat: Add knowledge doc templates and /knowledge command (FLY-255)
35
+ fix: Handle null milestone in create_issue response (FLY-301)
36
+ chore: Remove deprecated auth middleware (FLY-290)
37
+ ```
38
+
39
+ ## When to Create a PR
40
+
41
+ **Create a PR when:**
42
+
43
+ - Changes affect shared code (not just local config or docs)
44
+ - Multiple files changed across different concerns
45
+ - Changes need review before merging
46
+ - Working on a branch (not committing directly to main)
47
+
48
+ **Commit directly when:**
49
+
50
+ - Single-file documentation updates
51
+ - Config changes for local development
52
+ - Trivial fixes (typos, formatting)
53
+ - The user explicitly requests direct commit
54
+
55
+ When in doubt, create a PR. It's easier to merge a PR than to revert a direct commit.
56
+
57
+ ## PR Description Template
58
+
59
+ The canonical PR template lives at `templates/pr/default.md`. Use the PR
60
+ dispatcher to create PRs with auto-populated issue context:
61
+
62
+ ```bash
63
+ python3 .claude/skills/flydocs-workflow/scripts/issues.py pr --issue FLY-123
64
+ ```
65
+
66
+ Options:
67
+
68
+ | Flag | Purpose |
69
+ | ----------- | ----------------------------------------- |
70
+ | `--issue` | Link to issue (auto-populates title + AC) |
71
+ | `--title` | Override PR title |
72
+ | `--base` | Target branch (defaults to main/master) |
73
+ | `--draft` | Create as draft PR |
74
+ | `--dry-run` | Preview without creating |
75
+
76
+ The script:
77
+
78
+ - Detects platform (GitHub, GitLab) from git remote
79
+ - Reads the PR template and fills in issue context
80
+ - Creates the PR via `gh pr create` or `glab mr create`
81
+ - Posts a comment on the issue linking the PR
82
+
83
+ **Enforcement:** A PostToolUse hook (`post-pr-check.py`) detects direct
84
+ `gh pr create` or `glab mr create` calls and warns if required sections
85
+ (Summary, Test Plan) are missing.
86
+
87
+ ### Template Sections
88
+
89
+ | Section | Required | Auto-populated |
90
+ | ----------------------- | -------- | ------------------------ |
91
+ | **Summary** | Yes | From issue title |
92
+ | **Changes** | No | Manual |
93
+ | **Test Plan** | Yes | Manual |
94
+ | **Acceptance Criteria** | No | From issue AC checkboxes |
95
+ | **Notes** | No | Manual |
96
+
97
+ ## PR Workflow in Practice
98
+
99
+ ### During Implement Stage
100
+
101
+ After self-review (step 7 in `implement.md`), before handing off to review:
102
+
103
+ 1. Create branch: `git checkout -b <type>/<ref>-<slug>`
104
+ 2. Stage and commit changes with a descriptive message
105
+ 3. Push branch: `git push -u origin <branch>`
106
+ 4. Create PR: `python3 .claude/skills/flydocs-workflow/scripts/issues.py pr --issue <ref>`
107
+ 5. Include the PR link in the "Ready for Review" comment
108
+
109
+ ### During Review Stage
110
+
111
+ The reviewer should:
112
+
113
+ - Review the PR diff (not just local git diff)
114
+ - Leave comments on the PR for specific code feedback
115
+ - Reference the PR in review comments on the issue
116
+
117
+ ### After Review
118
+
119
+ - **Approved**: Merge the PR, then transition issue to Testing
120
+ - **Changes needed**: Push fixes to the same branch, re-request review
@@ -2,27 +2,49 @@
2
2
 
3
3
  ## Priority Values
4
4
 
5
- | Value | Name | Use When |
6
- |-------|------|----------|
7
- | 0 | None | Not yet triaged |
8
- | 1 | Urgent | Drop everything, fix now |
9
- | 2 | High | Next up, unblocks others |
10
- | 3 | Medium | Normal priority (default) |
11
- | 4 | Low | Nice to have |
5
+ | Value | Name | Use When |
6
+ | ----- | ------ | ------------------------- |
7
+ | 0 | None | Not yet triaged |
8
+ | 1 | Urgent | Drop everything, fix now |
9
+ | 2 | High | Next up, unblocks others |
10
+ | 3 | Medium | Normal priority (default) |
11
+ | 4 | Low | Nice to have |
12
12
 
13
13
  ## Estimate Values (Complexity)
14
14
 
15
- | Value | Name | Rough Effort |
16
- |-------|------|--------------|
17
- | 1 | XS | < 1 hour |
18
- | 2 | S | 1-4 hours |
19
- | 3 | M | Half day to full day |
20
- | 4 | L | 2-3 days |
21
- | 5 | XL | Week+ |
15
+ | Value | Name | Rough Effort |
16
+ | ----- | ---- | -------------------- |
17
+ | 1 | XS | < 1 hour |
18
+ | 2 | S | 1-4 hours |
19
+ | 3 | M | Half day to full day |
20
+ | 4 | L | 2-3 days |
21
+ | 5 | XL | Week+ |
22
22
 
23
23
  ## Guidance
24
24
 
25
25
  - Set priority during Refine or Activate stages
26
26
  - Set estimate during Refine stage (before Ready)
27
27
  - If estimate is missing at Activate, set it before transitioning
28
- - XL estimates often indicate the issue should be broken into smaller pieces
28
+ - Estimate values may vary by provider the relay translates per provider configuration
29
+
30
+ ## Decomposition
31
+
32
+ When an estimate is large (XL / 5+ or provider equivalent), prompt for decomposition:
33
+
34
+ 1. **Identify natural boundaries** — separate concerns, independent deliverables, sequential phases
35
+ 2. **Create child issues** — each should be independently estimable at M or smaller
36
+ 3. **Link parent to children** — use `issues.py link` with type `blocks` (parent blocks children conceptually)
37
+ 4. **Re-estimate parent** — set to 0 or remove estimate, since children carry the work
38
+ 5. **Move parent to a tracking role** — it becomes the "epic" or summary issue
39
+
40
+ **Split pattern:**
41
+
42
+ ```
43
+ Original: FLY-100 "Build auth system" (XL)
44
+ → FLY-101 "Add login endpoint" (S)
45
+ → FLY-102 "Add session management" (M)
46
+ → FLY-103 "Add role-based access control" (M)
47
+ → FLY-104 "Add password reset flow" (S)
48
+ ```
49
+
50
+ Don't force decomposition on every large issue — some are genuinely large and atomic. Use judgment. The prompt is: "This is estimated as XL. Can it be broken into smaller, independently deliverable pieces?"
@@ -0,0 +1,251 @@
1
+ # Service Descriptor Schema
2
+
3
+ Reference for `flydocs/context/service.json` — the dual-purpose descriptor that
4
+ provides cross-repo context AND intra-repo orientation.
5
+
6
+ ## Purpose
7
+
8
+ The service descriptor serves two roles from a single file:
9
+
10
+ - **Cross-repo export** — `apis`, `dependencies`, `purpose`, `stack` tell
11
+ sibling repos what this service does and how it connects. Stored by relay,
12
+ queried by workspace composite.
13
+ - **Intra-repo orientation** — `structure` section tells THIS repo's agent
14
+ where things are: entry points, shared types, build system, package boundaries.
15
+ Not exported cross-repo.
16
+
17
+ Generated by the user's coding agent during `/flydocs-setup` Phase 1.5.
18
+
19
+ ## Schema
20
+
21
+ ```typescript
22
+ interface ServiceDescriptor {
23
+ version: 1;
24
+ name: string; // Human-readable service name
25
+ repoSlug: string; // owner/repo format (matches workspace.repoSlug)
26
+ purpose: string; // One-sentence description of what this service does
27
+ stack: string[]; // Key technologies: ["next", "convex", "typescript"]
28
+
29
+ // Cross-repo export surface (what siblings see)
30
+ apis: ApiSurface[];
31
+ dependencies: ServiceDependency[];
32
+
33
+ // Intra-repo orientation (what THIS repo's agent uses)
34
+ structure: ServiceStructure;
35
+ }
36
+
37
+ interface ApiSurface {
38
+ type: "rest" | "graphql" | "grpc" | "event" | "package";
39
+ path: string; // Route prefix, event topic, or package path
40
+ description: string; // What this API surface does
41
+ methods?: string[]; // HTTP methods for REST (optional)
42
+ }
43
+
44
+ interface ServiceDependency {
45
+ service: string; // Repo slug or service name of the dependency
46
+ interface: string; // What interface is consumed (e.g., "REST /api/relay/*")
47
+ description: string; // Why this dependency exists
48
+ }
49
+
50
+ interface ServiceStructure {
51
+ entryPoints: string[]; // Where request handling or app logic starts
52
+ sharedTypes: string[]; // Where shared type definitions live
53
+ buildSystem: string; // "turbo", "nx", "next", "tsup", "vite", "cargo", etc.
54
+ packages?: PackageInfo[]; // Monorepo only: name, path, purpose per package
55
+ }
56
+
57
+ interface PackageInfo {
58
+ name: string; // Package name (e.g., "@flydocs/cli")
59
+ path: string; // Relative path from repo root
60
+ purpose: string; // What this package does
61
+ }
62
+ ```
63
+
64
+ ## Field Notes
65
+
66
+ - `version` is always `1`. Will increment on breaking schema changes.
67
+ - `repoSlug` must match the slug registered in the workspace dashboard.
68
+ - `structure` is local-only — not pushed to relay or included in workspace composite.
69
+ - `apis` and `dependencies` create PROVIDES/CONSUMES edges in the graph.
70
+ - `stack` is a flat array of lowercase identifiers (framework names, languages).
71
+ - Agent scans the codebase to populate all fields during setup Phase 1.5.
72
+
73
+ ## Examples
74
+
75
+ ### Example 1: Single-App CLI Tool (Type 1)
76
+
77
+ ```json
78
+ {
79
+ "version": 1,
80
+ "name": "FlyDocs CLI",
81
+ "repoSlug": "plastrlab/flydocs-core",
82
+ "purpose": "CLI tool that installs and manages FlyDocs skill templates, hooks, and configuration in user projects",
83
+ "stack": ["typescript", "node", "commander"],
84
+ "apis": [
85
+ {
86
+ "type": "package",
87
+ "path": "@flydocs/cli",
88
+ "description": "npm package providing the flydocs CLI binary"
89
+ }
90
+ ],
91
+ "dependencies": [
92
+ {
93
+ "service": "plastrlab/flydocs-app",
94
+ "interface": "REST /api/relay/*",
95
+ "description": "Cloud tier pushes config, descriptors, and issue operations to relay API"
96
+ }
97
+ ],
98
+ "structure": {
99
+ "entryPoints": ["src/cli.ts"],
100
+ "sharedTypes": ["src/lib/types.ts"],
101
+ "buildSystem": "tsup"
102
+ }
103
+ }
104
+ ```
105
+
106
+ ### Example 2: Full-Stack Web App (Type 1)
107
+
108
+ ```json
109
+ {
110
+ "version": 1,
111
+ "name": "FlyDocs App",
112
+ "repoSlug": "plastrlab/flydocs-app",
113
+ "purpose": "Web dashboard and relay API for FlyDocs cloud tier — workspace management, issue relay, and service descriptor storage",
114
+ "stack": ["next", "react", "convex", "typescript", "tailwind"],
115
+ "apis": [
116
+ {
117
+ "type": "rest",
118
+ "path": "/api/relay",
119
+ "description": "Relay API for CLI operations — config generation, issue proxy, service descriptors",
120
+ "methods": ["GET", "POST", "PUT", "PATCH"]
121
+ },
122
+ {
123
+ "type": "rest",
124
+ "path": "/api/auth",
125
+ "description": "Authentication endpoints for CLI and dashboard login",
126
+ "methods": ["GET", "POST"]
127
+ }
128
+ ],
129
+ "dependencies": [
130
+ {
131
+ "service": "linear",
132
+ "interface": "GraphQL API",
133
+ "description": "Issue tracker backend — all issue CRUD proxied through relay"
134
+ },
135
+ {
136
+ "service": "convex",
137
+ "interface": "Convex functions",
138
+ "description": "Real-time database for workspaces, repos, user state"
139
+ }
140
+ ],
141
+ "structure": {
142
+ "entryPoints": ["src/app/api/", "convex/"],
143
+ "sharedTypes": ["src/types/", "convex/schema.ts"],
144
+ "buildSystem": "next"
145
+ }
146
+ }
147
+ ```
148
+
149
+ ### Example 3: Monorepo Multi-Service (Type 3)
150
+
151
+ ```json
152
+ {
153
+ "version": 1,
154
+ "name": "Acme Platform",
155
+ "repoSlug": "acme/platform",
156
+ "purpose": "Monorepo containing API server, worker service, and shared packages for the Acme SaaS platform",
157
+ "stack": ["typescript", "express", "prisma", "redis", "turborepo"],
158
+ "apis": [
159
+ {
160
+ "type": "rest",
161
+ "path": "/api/v2",
162
+ "description": "Public REST API for client applications",
163
+ "methods": ["GET", "POST", "PUT", "DELETE"]
164
+ },
165
+ {
166
+ "type": "event",
167
+ "path": "jobs.*",
168
+ "description": "Redis pub/sub events consumed by worker service"
169
+ },
170
+ {
171
+ "type": "package",
172
+ "path": "@acme/sdk",
173
+ "description": "Published TypeScript SDK for API consumers"
174
+ }
175
+ ],
176
+ "dependencies": [
177
+ {
178
+ "service": "stripe",
179
+ "interface": "REST API + webhooks",
180
+ "description": "Payment processing and subscription management"
181
+ },
182
+ {
183
+ "service": "acme/marketing-site",
184
+ "interface": "REST /api/v2/pricing",
185
+ "description": "Marketing site fetches pricing data from API"
186
+ }
187
+ ],
188
+ "structure": {
189
+ "entryPoints": ["apps/api/src/server.ts", "apps/worker/src/index.ts"],
190
+ "sharedTypes": ["packages/shared/src/types/"],
191
+ "buildSystem": "turbo",
192
+ "packages": [
193
+ {
194
+ "name": "@acme/api",
195
+ "path": "apps/api",
196
+ "purpose": "Express API server — handles all client requests"
197
+ },
198
+ {
199
+ "name": "@acme/worker",
200
+ "path": "apps/worker",
201
+ "purpose": "Background job processor — email, billing, data sync"
202
+ },
203
+ {
204
+ "name": "@acme/shared",
205
+ "path": "packages/shared",
206
+ "purpose": "Shared types, utilities, and validation schemas"
207
+ },
208
+ {
209
+ "name": "@acme/sdk",
210
+ "path": "packages/sdk",
211
+ "purpose": "Published TypeScript SDK for external API consumers"
212
+ }
213
+ ]
214
+ }
215
+ }
216
+ ```
217
+
218
+ ## Graph Integration
219
+
220
+ When `graph_build.py` processes `service.json`:
221
+
222
+ 1. Creates a `repo:{repoSlug}` node with `purpose` and `stack` as properties
223
+ 2. For each entry in `apis`: creates a PROVIDES edge from this repo to any
224
+ repo that lists it in their `dependencies`
225
+ 3. For each entry in `dependencies`: creates a CONSUMES edge from this repo
226
+ to the dependency's repo node
227
+ 4. Edge properties include `interface` and `description` from the source data
228
+
229
+ Cross-repo edges are only created when both repos have service descriptors in
230
+ the graph (either from local sibling reads or relay workspace composite).
231
+
232
+ ## Relay Integration
233
+
234
+ - **Push:** `push_service.py` sends this repo's descriptor via
235
+ `PUT /api/relay/workspace/service` (excludes `structure` section)
236
+ - **Pull:** `pull_services.py` fetches workspace composite via
237
+ `GET /api/relay/workspace/services` (returns all repos with descriptors)
238
+ - **Local fallback:** Read sibling `flydocs/context/service.json` files directly
239
+
240
+ ## Topology Context
241
+
242
+ The service descriptor works alongside topology detection (stored in config).
243
+ Topology tells the agent HOW repos are laid out; the descriptor tells it WHAT
244
+ each repo does and how they connect.
245
+
246
+ | Topology Type | Layout | Detection Signal |
247
+ | ------------- | ----------------------- | -------------------------------------------- |
248
+ | 1 | Single repo, single app | One `.git`, no workspace config |
249
+ | 2 | Monorepo, single app | One `.git`, one root app |
250
+ | 3 | Monorepo, multi-service | One `.git`, workspace config (pnpm/nx/turbo) |
251
+ | 4 | Sibling repos | Parent dir has multiple `.git` children |
@@ -10,41 +10,41 @@ BACKLOG ──→ READY ──→ IMPLEMENTING ──→ REVIEW ──→ TESTIN
10
10
 
11
11
  ## State Meanings
12
12
 
13
- | FlyDocs State | Intent | Assignment Required |
14
- |---------------|--------|---------------------|
15
- | BACKLOG | Raw capture, not yet refined | No |
16
- | READY | Refined spec, ready to pick up | No |
17
- | IMPLEMENTING | Active work in progress | **Yes** |
18
- | BLOCKED | Cannot proceed, waiting on resolution | Yes |
19
- | REVIEW | Code complete, awaiting quality review | Yes |
20
- | TESTING | Review passed, awaiting user acceptance | Yes |
21
- | COMPLETE | All stages passed, work delivered | Yes |
13
+ | FlyDocs State | Intent | Assignment Required |
14
+ | ------------- | --------------------------------------- | ------------------- |
15
+ | BACKLOG | Raw capture, not yet refined | No |
16
+ | READY | Refined spec, ready to pick up | No |
17
+ | IMPLEMENTING | Active work in progress | **Yes** |
18
+ | BLOCKED | Cannot proceed, waiting on resolution | Yes |
19
+ | REVIEW | Code complete, awaiting quality review | Yes |
20
+ | TESTING | Review passed, awaiting user acceptance | Yes |
21
+ | COMPLETE | All stages passed, work delivered | Yes |
22
22
 
23
23
  ## Valid Transitions
24
24
 
25
- | From | To | Trigger |
26
- |------|----|---------|
27
- | BACKLOG | READY | Refine stage completes |
28
- | READY | IMPLEMENTING | Activate stage completes |
29
- | IMPLEMENTING | REVIEW | Implement stage completes |
30
- | IMPLEMENTING | BLOCKED | Blocker identified |
31
- | BLOCKED | IMPLEMENTING | Blocker resolved |
32
- | REVIEW | TESTING | Code review passes |
33
- | REVIEW | IMPLEMENTING | Code review finds issues |
34
- | TESTING | COMPLETE | QE approves, PM closes |
35
- | TESTING | IMPLEMENTING | QE finds issues |
25
+ | From | To | Trigger |
26
+ | ------------ | ------------ | ------------------------- |
27
+ | BACKLOG | READY | Refine stage completes |
28
+ | READY | IMPLEMENTING | Activate stage completes |
29
+ | IMPLEMENTING | REVIEW | Implement stage completes |
30
+ | IMPLEMENTING | BLOCKED | Blocker identified |
31
+ | BLOCKED | IMPLEMENTING | Blocker resolved |
32
+ | REVIEW | TESTING | Code review passes |
33
+ | REVIEW | IMPLEMENTING | Code review finds issues |
34
+ | TESTING | COMPLETE | QE approves, PM closes |
35
+ | TESTING | IMPLEMENTING | QE finds issues |
36
36
 
37
37
  ## Terminal States
38
38
 
39
- | State | When |
40
- |-------|------|
39
+ | State | When |
40
+ | --------------- | --------------------------- |
41
41
  | COMPLETE (Done) | Work delivered and verified |
42
- | ARCHIVED | Deferred — may return later |
43
- | CANCELED | Not pursuing |
44
- | DUPLICATE | See referenced issue |
42
+ | ARCHIVED | Deferred — may return later |
43
+ | CANCELED | Not pursuing |
44
+ | DUPLICATE | See referenced issue |
45
45
 
46
46
  ## Provider Mapping
47
47
 
48
- FlyDocs states are provider-agnostic. The mechanism skill maps them to provider-specific
48
+ FlyDocs states are provider-agnostic. The workflow scripts map them to provider-specific
49
49
  state names via `statusMapping` in `.flydocs/config.json`. The workflow never references
50
50
  provider-specific names directly.