@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
@@ -4,7 +4,7 @@ Initial project onboarding — define project context, connect to provider, and
4
4
  create an initial backlog. This command handles two scenarios: new projects
5
5
  and FlyDocs version updates (including legacy content migration).
6
6
 
7
- Read the active mechanism skill's `SKILL.md` for script calling conventions
7
+ Read the workflow skill's `SKILL.md` for script calling conventions
8
8
  before executing any scripts.
9
9
 
10
10
  Triggers: "setup flydocs", "onboard project", "flydocs init"
@@ -48,7 +48,7 @@ Example:
48
48
 
49
49
  ```
50
50
  Detected: New project setup (cloud tier)
51
- I'll walk you through project definition, Linear setup, and initial backlog.
51
+ I'll walk you through project definition, provider setup, and initial backlog.
52
52
  Ready to begin?
53
53
  ```
54
54
 
@@ -73,13 +73,99 @@ If the directory exists and contains files:
73
73
  5. Offer to add relevant rules to `flydocs/context/project.md` (Standards
74
74
  section) or note them for the user to review.
75
75
  6. Skip rules that conflict with or duplicate FlyDocs workflow rules (e.g.,
76
- skill-led reasoning, mechanism scripts, session management).
76
+ skill-led reasoning, workflow scripts, session management).
77
77
 
78
78
  This is agent-guided — review and suggest, let the user confirm. No automated
79
79
  merging. If no backup directory exists, skip this phase silently.
80
80
 
81
81
  ---
82
82
 
83
+ ## Phase 0c: Topology Detection
84
+
85
+ Detect the project's physical layout. This affects Phase 1.5 (service
86
+ descriptor generation) and cross-repo context assembly.
87
+
88
+ **Step 1: Check for workspace config files.**
89
+
90
+ Look for these in the project root (in order):
91
+
92
+ - `pnpm-workspace.yaml` → Type 3 (monorepo multi-service)
93
+ - `nx.json` → Type 3
94
+ - `turbo.json` → Type 3
95
+ - `lerna.json` → Type 3
96
+ - `Cargo.toml` with `[workspace]` section → Type 3
97
+ - `go.work` → Type 3
98
+
99
+ If any found → **Type 3: Monorepo, multi-service**. Record which config file
100
+ was detected.
101
+
102
+ **Step 2: Check parent directory for sibling repos.**
103
+
104
+ If no workspace config found, check one directory up from the project root:
105
+
106
+ - List subdirectories of the parent directory
107
+ - Check which ones contain a `.git` directory
108
+ - If 2+ sibling directories (including this one) have `.git` → **Type 4: Sibling repos**
109
+ - Record the sibling repo directory names
110
+
111
+ **Step 3: Determine single-app vs monorepo-single.**
112
+
113
+ If neither workspace config nor sibling repos detected:
114
+
115
+ - Check if the project has multiple `package.json` files in subdirectories
116
+ (e.g., `apps/*/package.json`, `packages/*/package.json`)
117
+ - If yes → **Type 2: Monorepo, single app** (monorepo tooling without workspace config)
118
+ - If no → **Type 1: Single repo, single app**
119
+
120
+ **Step 4: Report and store.**
121
+
122
+ Tell the user what was detected:
123
+
124
+ ```
125
+ Topology: Monorepo multi-service (Type 3)
126
+ Detected via: pnpm-workspace.yaml
127
+ ```
128
+
129
+ Update `.flydocs/config.json` with the `topology` field:
130
+
131
+ ```json
132
+ {
133
+ "topology": {
134
+ "type": 3,
135
+ "label": "monorepo-multi",
136
+ "detectedVia": "pnpm-workspace.yaml"
137
+ }
138
+ }
139
+ ```
140
+
141
+ For Type 4 (sibling repos), also include:
142
+
143
+ ```json
144
+ {
145
+ "topology": {
146
+ "type": 4,
147
+ "label": "sibling-repos",
148
+ "detectedVia": "parent directory scan",
149
+ "siblingRepos": ["flydocs-core", "flydocs-app", "flydocs-marketing"]
150
+ }
151
+ }
152
+ ```
153
+
154
+ For Type 3 with a workspace root different from project root:
155
+
156
+ ```json
157
+ {
158
+ "topology": {
159
+ "type": 3,
160
+ "label": "monorepo-multi",
161
+ "detectedVia": "turbo.json",
162
+ "workspaceRoot": "."
163
+ }
164
+ }
165
+ ```
166
+
167
+ ---
168
+
83
169
  ## Phase 1: Project Definition
84
170
 
85
171
  The goal is to fill every section of `flydocs/context/project.md` with real
@@ -283,6 +369,114 @@ may be useful:
283
369
 
284
370
  ---
285
371
 
372
+ ## Phase 1.5: Service Descriptor Generation
373
+
374
+ Generate `flydocs/context/service.json` — the dual-purpose descriptor that
375
+ provides cross-repo context AND intra-repo orientation. This phase uses the
376
+ topology detected in Phase 0c and stack detected in Phase 1.
377
+
378
+ Read `.claude/skills/flydocs-context-graph/service-descriptor-schema.md` for
379
+ the full schema reference before proceeding.
380
+
381
+ **Step 1: Scan for cross-repo export surface.**
382
+
383
+ Identify what this repo exposes to the outside world:
384
+
385
+ - **REST/GraphQL APIs** — scan for route definitions, API directories, endpoint
386
+ patterns. Look in common locations: `src/app/api/`, `src/routes/`,
387
+ `pages/api/`, `server/routes/`, `api/`.
388
+ - **Published packages** — check `package.json` for `name` field if it looks
389
+ like a library (`@scope/package` or explicitly `"private": false`).
390
+ - **Events/messages** — check for pub/sub, message queue, or webhook patterns.
391
+ - **gRPC** — check for `.proto` files.
392
+
393
+ For each API surface found, capture: type, path, description, and methods
394
+ (for REST).
395
+
396
+ **Step 2: Scan for dependencies on other services.**
397
+
398
+ Identify what this repo consumes from external services:
399
+
400
+ - Check environment variables (`.env.example`, `.env.local`) for service URLs,
401
+ API keys, or connection strings that reference other internal services.
402
+ - Check `package.json` for internal package references (`workspace:*`).
403
+ - Check import patterns for cross-service API clients.
404
+ - Check config files for external service endpoints.
405
+
406
+ For each dependency, capture: service name, interface type, and description.
407
+
408
+ **Step 3: Scan for intra-repo structure.**
409
+
410
+ Help the agent orient within THIS repo:
411
+
412
+ - **Entry points** — where does request handling or app logic start?
413
+ - Web frameworks: `src/app/`, `pages/`, `src/routes/`
414
+ - CLI tools: `src/cli.ts`, `src/index.ts`, `src/main.ts`
415
+ - Workers: `src/worker/`, `src/jobs/`
416
+ - **Shared types** — where do type definitions live?
417
+ - `src/types/`, `src/lib/types.ts`, `types/`, `packages/shared/`
418
+ - **Build system** — what builds the project?
419
+ - Read from `package.json` scripts, config files: turbo, nx, next, vite,
420
+ tsup, webpack, cargo, go
421
+ - **Packages** (monorepo Type 3 only) — scan workspace packages:
422
+ - Read `pnpm-workspace.yaml`, `turbo.json`, or `nx.json` for package list
423
+ - For each package: name, path, one-line purpose
424
+
425
+ **Step 4: Compose and confirm the descriptor.**
426
+
427
+ Build the `service.json` from scan results. Show the user the complete
428
+ descriptor and ask for confirmation or corrections:
429
+
430
+ ```
431
+ Service Descriptor for [repo name]:
432
+
433
+ Purpose: [one-sentence description]
434
+ Stack: [technology list]
435
+
436
+ APIs exposed:
437
+ - REST /api/relay/* — Relay API for CLI operations
438
+ - package @flydocs/cli — npm CLI binary
439
+
440
+ Dependencies:
441
+ - plastrlab/flydocs-app (REST /api/relay/*) — cloud tier operations
442
+
443
+ Structure:
444
+ - Entry: src/cli.ts
445
+ - Types: src/lib/types.ts
446
+ - Build: tsup
447
+
448
+ Write to flydocs/context/service.json?
449
+ ```
450
+
451
+ **Step 5: Write the descriptor.**
452
+
453
+ After user approval, write `flydocs/context/service.json` with the confirmed
454
+ content. Use the schema version `1`.
455
+
456
+ **Step 6: Push to relay (cloud tier only).**
457
+
458
+ For cloud tier projects, push the descriptor to the relay:
459
+
460
+ ```bash
461
+ python3 .claude/skills/flydocs-context-graph/scripts/push_service.py
462
+ ```
463
+
464
+ This calls `PUT /api/relay/workspace/service` with the descriptor content
465
+ (excluding the `structure` section which is local-only).
466
+
467
+ **Step 7: Pull workspace composite (cloud tier only).**
468
+
469
+ After pushing, pull the workspace composite to see sibling descriptors:
470
+
471
+ ```bash
472
+ python3 .claude/skills/flydocs-context-graph/scripts/pull_services.py
473
+ ```
474
+
475
+ This calls `GET /api/relay/workspace/services` and caches the result for
476
+ graph building and prompt hook orientation.
477
+
478
+ ---
479
+
286
480
  ## Phase 2: Provider Setup — Cloud Only
287
481
 
288
482
  > **Local tier:** Skip this phase entirely. Print: "Local tier — no provider
@@ -301,60 +495,109 @@ FLYDOCS_API_KEY is not set. Run `flydocs connect` first to set up your API key.
301
495
 
302
496
  Do not proceed until the key is available.
303
497
 
304
- **Step 2: Select or create team.**
498
+ **Step 2: Detect or select provider.**
499
+
500
+ Query connected providers:
501
+
502
+ ```bash
503
+ python3 .claude/skills/flydocs-workflow/scripts/workspace.py list-integrations
504
+ ```
505
+
506
+ This returns `[{type, name, connected}]`. Handle based on results:
507
+
508
+ - **One connected provider** — auto-select it and confirm with the user.
509
+ - **Multiple connected providers** — present a numbered list, let the user
510
+ choose which to use for this project.
511
+ - **No connected providers** — error: "No providers connected. Connect Linear
512
+ or Jira at app.flydocs.ai before running setup."
513
+
514
+ After selection, store the preference:
515
+
516
+ ```bash
517
+ python3 .claude/skills/flydocs-workflow/scripts/workspace.py set-provider <provider_type>
518
+ ```
519
+
520
+ This stores the provider type on the relay (for routing) and updates
521
+ `provider.type` in local config.
522
+
523
+ **Step 3: Select or create team/project.**
524
+
525
+ > For Linear, this selects a team. For Jira, this selects a project. The relay
526
+ > normalizes both as "teams" in the API.
305
527
 
306
528
  If `provider.teamId` in config is null, discover available teams:
307
529
 
308
530
  ```bash
309
- python3 .claude/skills/flydocs-cloud/scripts/list_teams.py
531
+ python3 .claude/skills/flydocs-workflow/scripts/workspace.py teams
310
532
  ```
311
533
 
312
534
  Present the teams to the user as a numbered list showing name and key.
313
- Add a final option: **"Create a new team"**. If only one team exists,
535
+ Add a final option: **"Create a new team/project"**. If only one team exists,
314
536
  confirm it.
315
537
 
316
- If the user selects **"Create a new team"**:
538
+ If the user selects **"Create a new team/project"**:
317
539
 
318
540
  1. Ask for team name (required) and key (optional — auto-generated if omitted)
319
- 2. Ask if this should be a sub-team under an existing team (show the list
320
- again for parent selection, or "None — top-level team")
541
+ 2. **Linear only:** Ask if this should be a sub-team under an existing team
542
+ (show the list again for parent selection, or "None — top-level team").
543
+ For Jira, skip the parent option — Jira projects do not have a parent
544
+ hierarchy.
321
545
  3. Create via:
322
546
 
323
547
  ```bash
324
- python3 .claude/skills/flydocs-cloud/scripts/create_team.py --name "Team Name" [--key KEY] [--parent <parent_team_id>]
548
+ python3 .claude/skills/flydocs-workflow/scripts/workspace.py set-team --name "Team Name" [--key KEY] [--parent <parent_team_id>]
325
549
  ```
326
550
 
551
+ > The `--parent` flag is Linear-only (sub-teams). Omit for Jira.
552
+
327
553
  After selection or creation, store the preference on the relay and in local
328
554
  config:
329
555
 
330
556
  ```bash
331
- python3 .claude/skills/flydocs-cloud/scripts/set_team.py <team_id>
557
+ python3 .claude/skills/flydocs-workflow/scripts/workspace.py set-team <team_id>
332
558
  ```
333
559
 
334
560
  This stores the team preference server-side (the relay uses it for all
335
561
  team-scoped operations) and updates `provider.teamId` in local config.
562
+ For Jira, this sets the active Jira project.
563
+
564
+ **Step 4: Get or create project (Linear only).**
336
565
 
337
- **Step 3: Get or create project.**
566
+ > **Jira provider:** Skip this step. Jira organizes issues directly within
567
+ > projects (selected in Step 3). There is no secondary project container.
338
568
 
339
569
  Query existing projects:
340
570
 
341
571
  ```bash
342
- python3 .claude/skills/flydocs-cloud/scripts/list_projects.py
572
+ python3 .claude/skills/flydocs-workflow/scripts/projects.py list-projects
343
573
  ```
344
574
 
345
575
  If matching projects exist, let the user select one. Otherwise, offer to
346
576
  create a new project:
347
577
 
348
578
  ```bash
349
- python3 .claude/skills/flydocs-cloud/scripts/create_project.py --name "Project Name"
579
+ python3 .claude/skills/flydocs-workflow/scripts/projects.py create-project --name "Project Name"
580
+ ```
581
+
582
+ **Step 4b: Set active project.**
583
+
584
+ After selecting or creating a project, store it as the active project:
585
+
586
+ ```bash
587
+ python3 .claude/skills/flydocs-workflow/scripts/workspace.py set-active-project <project_id>
350
588
  ```
351
589
 
352
- **Step 4: Configure labels.**
590
+ This writes `workspace.activeProjects` in `.flydocs/config.json`. All
591
+ subsequent operations (issue listing, captures, milestones, project updates)
592
+ use this to scope work to the active project. This is a critical step —
593
+ without it, product scope filtering and project-update targeting won't work.
594
+
595
+ **Step 5: Configure labels.**
353
596
 
354
597
  Fetch available labels from the provider:
355
598
 
356
599
  ```bash
357
- python3 .claude/skills/flydocs-cloud/scripts/list_labels.py
600
+ python3 .claude/skills/flydocs-workflow/scripts/workspace.py labels
358
601
  ```
359
602
 
360
603
  **Auto-detect type mapping:** Scan the returned labels for common names
@@ -376,7 +619,7 @@ available labels as options.
376
619
  Store the configuration on the relay:
377
620
 
378
621
  ```bash
379
- python3 .claude/skills/flydocs-cloud/scripts/set_labels.py \
622
+ python3 .claude/skills/flydocs-workflow/scripts/workspace.py set-labels \
380
623
  --defaults '["app"]' \
381
624
  --type-map '{"feature":["Feature"],"bug":["Bug"],"chore":["Chore"],"idea":["Improvement"]}'
382
625
  ```
@@ -384,7 +627,49 @@ python3 .claude/skills/flydocs-cloud/scripts/set_labels.py \
384
627
  If the relay returns `LABELS_NOT_FOUND`, show the invalid names and ask the
385
628
  user to correct them.
386
629
 
387
- **Step 5: Configure product identity.**
630
+ **Step 6: Configure status mapping.**
631
+
632
+ Map provider workflow states to FlyDocs statuses. Run auto-mapping first:
633
+
634
+ ```bash
635
+ python3 .claude/skills/flydocs-workflow/scripts/workspace.py set-status-mapping --auto
636
+ ```
637
+
638
+ The relay auto-maps by case-insensitive name matching (e.g., "In Progress"
639
+ maps to `IMPLEMENTING`, "Done" maps to `COMPLETE`, "Backlog" maps to
640
+ `BACKLOG`).
641
+
642
+ **Review the result:** The response includes `matched` (number of statuses
643
+ successfully mapped) and `total` (total FlyDocs statuses). Show the user
644
+ the `mapping` object:
645
+
646
+ ```
647
+ Status mapping (matched 6/10):
648
+ BACKLOG -> Backlog
649
+ READY -> Ready
650
+ IMPLEMENTING -> In Progress
651
+ REVIEW -> In Review
652
+ COMPLETE -> Done
653
+ CANCELED -> Canceled
654
+ ```
655
+
656
+ If `matched < total`, some statuses are unmapped — **warn but don't block**.
657
+ Transitions for unmapped statuses will fall back to provider name matching.
658
+ If the user wants to fix unmapped statuses, fetch available provider states
659
+ and let them map manually:
660
+
661
+ ```bash
662
+ python3 .claude/skills/flydocs-workflow/scripts/workspace.py statuses
663
+ ```
664
+
665
+ Then store the corrected mapping:
666
+
667
+ ```bash
668
+ python3 .claude/skills/flydocs-workflow/scripts/workspace.py set-status-mapping \
669
+ --mapping '{"BACKLOG":"Backlog","IMPLEMENTING":"In Progress","BLOCKED":"On Hold",...}'
670
+ ```
671
+
672
+ **Step 7: Configure product identity.**
388
673
 
389
674
  Ask about product metadata:
390
675
 
@@ -392,28 +677,51 @@ Ask about product metadata:
392
677
  from project.md)
393
678
  - **Icon and color** — optional, ask if they have preferences
394
679
 
395
- **Step 6: Save to config.**
680
+ **Step 8: Generate config from relay.**
681
+
682
+ The setup scripts in Steps 2-7 all POST to the relay — they no longer write
683
+ to local config. After all setup steps complete, pull the canonical config:
684
+
685
+ ```bash
686
+ python3 .claude/skills/flydocs-workflow/scripts/workspace.py config
687
+ ```
688
+
689
+ This calls `GET /config/generate` which returns all server-owned fields
690
+ (`workspaceId`, `setupComplete`, `workspace`, `issueLabels`). The script
691
+ merges these with local-only fields (`tier`, `detectedStack`, `skills`,
692
+ `designSystem`, `aiLabor`, `paths`) and writes `.flydocs/config.json`.
693
+
694
+ It also cleans up ghost fields (`provider`, `statusMapping`, `labels`) that
695
+ were previously written by individual setup scripts but aren't in the TS
696
+ type system.
396
697
 
397
- Update `.flydocs/config.json`:
698
+ If the response includes `missing` or `warnings`, show them to the user
699
+ but don't block — they can fix in the dashboard and re-run later.
398
700
 
399
- - `provider.type` `"linear"` (set by connect command)
400
- - `provider.teamId` — selected team ID (set by `set_team.py`)
401
- - `labels.defaults` — default label names (set by `set_labels.py`)
402
- - `labels.typeMap` — type-to-label mapping (set by `set_labels.py`)
403
- - `workspace.activeProjects` — add the project ID
404
- - `workspace.product.name` — product name
701
+ **Step 9: Fetch user identity.**
702
+
703
+ ```bash
704
+ python3 .claude/skills/flydocs-workflow/scripts/workspace.py get-me
705
+ ```
706
+
707
+ This calls `GET /auth/me` (no workspace required) and writes
708
+ `.flydocs/me.json` with `displayName`, `email`, `providerId`, and
709
+ `providerIdentities`. The file is gitignored — each developer gets their own.
710
+
711
+ This enables `--mine` filters and personalizes session output.
405
712
 
406
713
  ---
407
714
 
408
715
  ## Phase 3: Milestones — Cloud Only
409
716
 
410
717
  > **Local tier:** Skip this phase entirely.
718
+ > **Jira provider:** Skip this phase. Milestone support for Jira is planned for a future release.
411
719
  > **FlyDocs Update:** Skip if milestones already exist.
412
720
 
413
721
  **Step 1: Check existing milestones.**
414
722
 
415
723
  ```bash
416
- python3 .claude/skills/flydocs-cloud/scripts/list_milestones.py
724
+ python3 .claude/skills/flydocs-workflow/scripts/projects.py list-milestones
417
725
  ```
418
726
 
419
727
  **Step 2: If milestones exist** — show them and confirm they'll be used for
@@ -436,11 +744,11 @@ Let the user customize names, descriptions, and target dates.
436
744
 
437
745
  **Step 4: Create milestones.**
438
746
 
439
- For each approved milestone:
747
+ For each approved milestone, pass the project ID from Phase 2 Step 3:
440
748
 
441
749
  ```bash
442
- python3 .claude/skills/flydocs-cloud/scripts/create_milestone.py \
443
- --name "Phase 1: Foundation" --target-date YYYY-MM-DD
750
+ python3 .claude/skills/flydocs-workflow/scripts/projects.py create-milestone \
751
+ --name "Phase 1: Foundation" --project <project_id> --target-date YYYY-MM-DD
444
752
  ```
445
753
 
446
754
  Record the milestone IDs for use in Phase 4.
@@ -468,21 +776,25 @@ For each work item, follow the capture procedure from
468
776
  `.claude/skills/flydocs-workflow/stages/capture.md`:
469
777
 
470
778
  - Determine type (feature, bug, chore, idea)
471
- - Create via the mechanism script:
779
+ - Create via the workflow script (cloud: pass `--project` from Phase 2 for
780
+ Linear; omit `--project` for Jira — issues are scoped to the team/project
781
+ selected in Phase 2 Step 3):
472
782
  ```bash
473
- python3 .claude/skills/flydocs-{tier}/scripts/create_issue.py \
474
- --title "Issue title" --type feature --priority 3 --estimate 2
783
+ python3 .claude/skills/flydocs-workflow/scripts/issues.py create \
784
+ --title "Issue title" --type feature --priority 3 --estimate 2 \
785
+ --project <project_id>
475
786
  ```
476
787
  - For quick ideas, use `--triage` flag
477
788
 
478
- **Step 3: Milestone assignment (cloud only).**
789
+ **Step 3: Milestone assignment (Linear only).**
479
790
 
480
791
  > **Local tier:** Skip this step.
792
+ > **Jira provider:** Skip this step.
481
793
 
482
794
  After creating issues, assign them to milestones:
483
795
 
484
796
  ```bash
485
- python3 .claude/skills/flydocs-cloud/scripts/assign_milestone.py \
797
+ python3 .claude/skills/flydocs-workflow/scripts/projects.py assign-milestone \
486
798
  <issue-ref> <milestone-id>
487
799
  ```
488
800
 
@@ -494,7 +806,7 @@ based on the issue content.
494
806
  **Step 1: Check if backlog is populated.**
495
807
 
496
808
  ```bash
497
- python3 .claude/skills/flydocs-{tier}/scripts/list_issues.py --limit 10
809
+ python3 .claude/skills/flydocs-workflow/scripts/issues.py list --limit 10
498
810
  ```
499
811
 
500
812
  If issues exist, skip this phase:
@@ -520,7 +832,7 @@ Only if the user wants to add more.
520
832
  List all issues in Backlog status:
521
833
 
522
834
  ```bash
523
- python3 .claude/skills/flydocs-cloud/scripts/list_issues.py --status BACKLOG
835
+ python3 .claude/skills/flydocs-workflow/scripts/issues.py list --status BACKLOG
524
836
  ```
525
837
 
526
838
  **Step 2: Set priorities.**
@@ -533,10 +845,10 @@ For each issue, suggest a priority and let the user confirm or adjust:
533
845
  - **4 (Low)** — Nice to have, no urgency
534
846
 
535
847
  ```bash
536
- python3 .claude/skills/flydocs-cloud/scripts/priority.py <issue-ref> <0-4>
848
+ python3 .claude/skills/flydocs-workflow/scripts/issues.py priority <issue-ref> <0-4>
537
849
  ```
538
850
 
539
- Note: Linear uses 0=No priority, 1=Urgent, 2=High, 3=Medium, 4=Low.
851
+ Note: Priority scale is 0=No priority, 1=Urgent, 2=High, 3=Medium, 4=Low.
540
852
 
541
853
  **Step 3: Set estimates.**
542
854
 
@@ -549,13 +861,13 @@ For each issue, suggest a t-shirt size estimate:
549
861
  - **5** — XL (1+ week, consider breaking down)
550
862
 
551
863
  ```bash
552
- python3 .claude/skills/flydocs-cloud/scripts/estimate.py <issue-ref> <1-5>
864
+ python3 .claude/skills/flydocs-workflow/scripts/issues.py estimate <issue-ref> <1-5>
553
865
  ```
554
866
 
555
867
  **Step 4: Identify dependencies.**
556
868
 
557
869
  Ask about blocking relationships between issues. If any exist, note them
558
- (Linear handles dependency tracking natively).
870
+ (most providers handle dependency tracking natively).
559
871
 
560
872
  **Step 5: Recommend implementation order.**
561
873
 
@@ -573,7 +885,7 @@ Recommended implementation order:
573
885
 
574
886
  ## Phase 6: Completion & Onboarding
575
887
 
576
- Summarize what was accomplished and provide a guided onboarding experience.
888
+ Summarize what was accomplished and guide the developer to onboarding.
577
889
 
578
890
  ### Step 1: Completion summary
579
891
 
@@ -585,7 +897,7 @@ Tier: [local / cloud]
585
897
 
586
898
  ✓ Project context: flydocs/context/project.md
587
899
  ✓ Stack detected: [framework list]
588
- ✓ Provider: [Linear connected / Local file-based] (if applicable)
900
+ ✓ Provider: [Connected / Local file-based] (if applicable)
589
901
  ✓ Milestones: [N created] (cloud only)
590
902
  ✓ Backlog: [N issues captured]
591
903
  ✓ Priorities set (cloud only)
@@ -593,43 +905,44 @@ Tier: [local / cloud]
593
905
 
594
906
  **Mark setup as complete.**
595
907
 
596
- Update `.flydocs/config.json` to set `setupComplete` to `true`. This disables
597
- the setup reminder in the prompt hook. Read the config, set the field, and
598
- write it back:
908
+ For **cloud tier**: Setup completion is determined by the relay. The
909
+ `workspace.py config` call in Phase 2 Step 8 already sets `setupComplete`
910
+ based on the relay's validation result. If the relay returns `valid: true`,
911
+ config will have `setupComplete: true`. If not, run `workspace.py validate` to
912
+ check what's still missing.
913
+
914
+ For **local tier**: Update `.flydocs/config.json` to set `setupComplete` to
915
+ `true`. Read the config, set the field, and write it back:
599
916
 
600
917
  ```json
601
918
  { "setupComplete": true }
602
919
  ```
603
920
 
604
- ### Step 2: Quick-start guide
921
+ ### Step 2: Direct to /onboard
605
922
 
606
- Present the core workflow commands with brief descriptions:
923
+ Check `.flydocs/config.json` for the `onboardComplete` field. If it is not
924
+ `true`, direct the developer to run `/onboard` for full project orientation:
607
925
 
608
926
  ```
609
- Here's how to work with FlyDocs:
927
+ Setup is done! Next step:
610
928
 
611
- Getting started:
612
- /start-session Begin a work session (sets focus, loads context)
613
- /activate Pick your next issue to work on
614
- /capture Capture a new issue or idea anytime
929
+ Run /onboard to get oriented to the codebase, active work, and available
930
+ commands. This is especially helpful for new team members joining the project.
931
+ ```
615
932
 
616
- During development:
617
- /implement Start implementation on your active issue
618
- /status Check current session and issue status
619
- /block Flag a blocker on the current issue
933
+ If `onboardComplete` is already `true` (developer has onboarded before),
934
+ skip the nudge and go straight to the quick-start reminder:
620
935
 
621
- Wrapping up:
622
- /review Submit work for code review
623
- /validate Run QE validation on completed work
624
- /wrap-session End your session (posts summary, saves progress)
936
+ ```
937
+ Setup refreshed. Run /start-session to begin working.
625
938
  ```
626
939
 
627
940
  ### Step 3: Tier-specific notes
628
941
 
629
942
  **For cloud tier:**
630
943
 
631
- - Linear project URL (if available from create_project response)
632
- - Recommend reviewing milestones in Linear's UI for timeline view
944
+ - Provider project URL (if available from create_project response)
945
+ - Recommend reviewing milestones in your provider's UI for timeline view
633
946
 
634
947
  **For local tier:**
635
948
 
@@ -683,11 +996,11 @@ Docs and updates: https://www.flydocs.ai
683
996
 
684
997
  Throughout the setup flow:
685
998
 
686
- - **Script failures** — If any mechanism script returns exit code 1, show the
999
+ - **Script failures** — If any workflow script returns exit code 1, show the
687
1000
  error message from stderr and ask the user how to proceed. Do not retry
688
1001
  silently.
689
1002
  - **Missing API key** — For cloud tier, cannot proceed past Phase 2 without
690
- `LINEAR_API_KEY`. Guide the user to set it up.
1003
+ `FLYDOCS_API_KEY`. Guide the user to set it up.
691
1004
  - **Missing config** — If `.flydocs/config.json` doesn't exist, the user
692
1005
  likely needs to run `flydocs` (install) first. Advise them accordingly.
693
1006
  - **Partial completion** — If the user needs to stop mid-setup, note which
@@ -698,18 +1011,18 @@ Throughout the setup flow:
698
1011
 
699
1012
  ## Key Rules
700
1013
 
701
- 1. **Always read the mechanism skill's `SKILL.md`** before running any script.
702
- Script calling conventions may differ between tiers.
1014
+ 1. **Always read the workflow skill's `SKILL.md`** before running any script.
1015
+ Script calling conventions are documented there.
703
1016
  2. **All script paths** follow the pattern:
704
- `python3 .claude/skills/flydocs-{tier}/scripts/<script>.py`
705
- where `{tier}` is read from `.flydocs/config.json`.
1017
+ `python3 .claude/skills/flydocs-workflow/scripts/<dispatcher>.py <subcommand>`
1018
+ The unified client auto-detects tier from `.flydocs/config.json`.
706
1019
  3. **Never skip user confirmation** on project.md content. This is their
707
1020
  project definition — they must approve it.
708
- 4. **Never hardcode tier** — always read from config. A project can switch
709
- tiers via `flydocs --tier <tier>`.
710
- 5. **Cloud scripts only for cloud tier.** Extended scripts (estimate, priority,
711
- milestones, projects) only exist in `flydocs-cloud`. Do not attempt to call
712
- them for local tier.
1021
+ 4. **Never hardcode tier** — the dispatcher scripts auto-detect tier from
1022
+ config. A project can switch tiers via `flydocs --tier <tier>`.
1023
+ 5. **Cloud-only operations.** Extended operations (estimate, priority,
1024
+ milestones, projects) are cloud-only. The dispatchers will error if called
1025
+ on local tier for unsupported operations.
713
1026
  6. **Capture procedure** — when creating issues during Phase 4, follow the
714
1027
  full capture procedure from `.claude/skills/flydocs-workflow/stages/capture.md`.
715
1028