@flydocs/cli 0.6.0-alpha.32 → 0.6.0-alpha.34

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flydocs/cli",
3
- "version": "0.6.0-alpha.32",
3
+ "version": "0.6.0-alpha.34",
4
4
  "type": "module",
5
5
  "description": "FlyDocs AI CLI — install, setup, and manage FlyDocs projects",
6
6
  "bin": {
@@ -63,6 +63,32 @@ scripts in `flydocs-workflow/scripts/`. The unified client auto-detects tier
63
63
  | `flydocs/context/service.json` | Service descriptor, topology, cross-repo context |
64
64
  | `.flydocs/config.json` | Tier, provider, labels, active projects, topology |
65
65
 
66
+ ## Dev Override: skipPaths
67
+
68
+ To prevent `flydocs sync` from overwriting paths you're actively developing,
69
+ add `artifactOverrides.skipPaths` to `.flydocs/config.json`:
70
+
71
+ ```json
72
+ {
73
+ "artifactOverrides": {
74
+ "skipPaths": [".claude/skills/flydocs-workflow/"]
75
+ }
76
+ }
77
+ ```
78
+
79
+ Paths listed here are excluded from artifact sync. This is CLI-local only —
80
+ not stored on the server, not visible in the portal, and preserved across syncs.
81
+
82
+ ## Credentials (Cloud Tier)
83
+
84
+ API keys are stored globally at `~/.flydocs/credentials`, written by:
85
+
86
+ - `flydocs init` — interactive setup (recommended)
87
+ - `flydocs auth` — set or update key directly
88
+
89
+ Resolution order: `FLYDOCS_API_KEY` env var > `~/.flydocs/credentials` > `.env.local` (legacy).
90
+ Never commit credentials to git.
91
+
66
92
  ## Hooks
67
93
 
68
94
  | Hook | Trigger | Purpose |
@@ -65,8 +65,9 @@ Count totals by status and type.
65
65
 
66
66
  **Step 3: Check for API readiness.**
67
67
 
68
- Check if `FLYDOCS_API_KEY` is set in the environment (from `.env` or
69
- `.env.local`). If not, warn the user they will need it for Phase 1.
68
+ Check if an API key is available via environment variable (`FLYDOCS_API_KEY`),
69
+ global credentials (`~/.flydocs/credentials`), or legacy `.env.local`. If not
70
+ found, warn the user to run `flydocs init` or `flydocs auth` before Phase 1.
70
71
 
71
72
  **Step 4: Present migration summary.**
72
73
 
@@ -30,8 +30,9 @@ python3 .claude/skills/flydocs-workflow/scripts/workspace.py get-me
30
30
  ```
31
31
  To connect to your workspace, you need a FlyDocs API key.
32
32
 
33
- Option A: Set FLYDOCS_API_KEY in .env.local (ask your team admin for the key)
34
- Option B: Run `npx flydocs install` which will prompt for the key
33
+ Option A: Run `flydocs init` (interactive setup recommended)
34
+ Option B: Run `flydocs auth` (set API key directly)
35
+ Option C: Set FLYDOCS_API_KEY in environment (CI/CD)
35
36
 
36
37
  Once set, run /onboard again.
37
38
  ```
@@ -52,17 +52,17 @@ class RelayBackend:
52
52
  self.api_key = self._load_api_key()
53
53
  if not self.api_key:
54
54
  fail(
55
- "FLYDOCS_API_KEY not found.\n"
56
- "Checked: environment, .env.local, .env, .env.development, .env.production\n"
57
- "To get your API key:\n"
58
- " 1. Go to app.flydocs.ai Settings → API Keys\n"
59
- " 2. Generate a key (starts with fdk_)\n"
60
- " 3. Add FLYDOCS_API_KEY=fdk_... to .env.local"
55
+ "FlyDocs API key not found.\n"
56
+ "Checked: environment, ~/.flydocs/credentials, .env.local (legacy)\n"
57
+ "To set up your API key:\n"
58
+ " 1. Run: flydocs init (interactive setup)\n"
59
+ " 2. Or: flydocs auth (set key directly)\n"
60
+ " 3. CI/CD: set FLYDOCS_API_KEY environment variable"
61
61
  )
62
62
 
63
- self.workspace_id = config.get("workspaceId")
63
+ self.workspace_id = self._resolve_workspace_id(config)
64
64
  if not self.workspace_id:
65
- fail("workspaceId not found in .flydocs/config.json. Run 'flydocs setup'")
65
+ fail("workspaceId not found. Run 'flydocs init' to set up your workspace.")
66
66
 
67
67
  self.repo_slug = self._detect_repo_slug()
68
68
  self.base_url = self._resolve_base_url()
@@ -72,9 +72,21 @@ class RelayBackend:
72
72
  self.team_id = config.get("provider", {}).get("teamId")
73
73
 
74
74
  def _load_api_key(self) -> Optional[str]:
75
+ # 1. Environment variable (CI/CD override)
75
76
  if os.environ.get("FLYDOCS_API_KEY"):
76
77
  return os.environ["FLYDOCS_API_KEY"]
77
- for name in [".env.local", ".env", ".env.development", ".env.production"]:
78
+ # 2. Global credential file (v2 — written by flydocs auth/init)
79
+ cred_file = Path.home() / ".flydocs" / "credentials"
80
+ if cred_file.exists():
81
+ try:
82
+ cred_data = json.loads(cred_file.read_text())
83
+ key = cred_data.get("apiKey") or cred_data.get("api_key")
84
+ if key:
85
+ return key
86
+ except (json.JSONDecodeError, OSError):
87
+ pass
88
+ # 3. Legacy per-project env files (v1 fallback)
89
+ for name in [".env.local", ".env"]:
78
90
  env_file = self.project_root / name
79
91
  if env_file.exists():
80
92
  key = self._parse_env_file(env_file, "FLYDOCS_API_KEY")
@@ -82,6 +94,23 @@ class RelayBackend:
82
94
  return key
83
95
  return None
84
96
 
97
+ def _resolve_workspace_id(self, config: dict) -> Optional[str]:
98
+ # 1. Config file (v2 — written by flydocs init/sync)
99
+ ws_id = config.get("workspaceId")
100
+ if ws_id:
101
+ return ws_id
102
+ # 2. Global credential file (v2 fallback)
103
+ cred_file = Path.home() / ".flydocs" / "credentials"
104
+ if cred_file.exists():
105
+ try:
106
+ cred_data = json.loads(cred_file.read_text())
107
+ ws_id = cred_data.get("workspaceId")
108
+ if ws_id:
109
+ return ws_id
110
+ except (json.JSONDecodeError, OSError):
111
+ pass
112
+ return None
113
+
85
114
  def _parse_env_file(self, path: Path, key: str) -> Optional[str]:
86
115
  with open(path, "r") as f:
87
116
  for line in f:
@@ -22,12 +22,15 @@
22
22
  #
23
23
 
24
24
  # ===========================================
25
- # CLOUD TIER: FlyDocs API Key (Recommended)
25
+ # CLOUD TIER: FlyDocs API Key
26
26
  # ===========================================
27
- # Use this if connecting via FlyDocs Cloud (managed relay).
28
- # Get from: your FlyDocs dashboard → API Keys
27
+ # Recommended: Use global credentials (stored in ~/.flydocs/credentials):
28
+ # flydocs init — interactive setup
29
+ # flydocs auth — set key directly
30
+ #
31
+ # For CI/CD: Set FLYDOCS_API_KEY as an environment variable.
32
+ # Legacy: Setting it here still works as a fallback.
29
33
  # Format: fdk_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
30
- # Set up with: flydocs connect
31
34
  FLYDOCS_API_KEY=
32
35
 
33
36
  # ===========================================
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "0.6.0-alpha.32",
2
+ "version": "0.6.0-alpha.34",
3
3
  "sourceRepo": "github.com/plastrlab/flydocs-core",
4
4
  "tier": "local",
5
5
  "setupComplete": false,
@@ -1 +1 @@
1
- 0.6.0-alpha.32
1
+ 0.6.0-alpha.34
@@ -19,6 +19,16 @@ the work — do not wait for explicit commands.
19
19
 
20
20
  All scripts: `python3 .claude/skills/flydocs-workflow/scripts/<dispatcher>`
21
21
 
22
+ ## Credentials
23
+
24
+ Cloud tier requires an API key. Resolution order:
25
+
26
+ 1. `FLYDOCS_API_KEY` environment variable (CI/CD)
27
+ 2. `~/.flydocs/credentials` (set by `flydocs init` or `flydocs auth`)
28
+ 3. `.env.local` (legacy fallback)
29
+
30
+ If scripts fail with "API key not found", run `flydocs init` or `flydocs auth`.
31
+
22
32
  ## Efficiency
23
33
 
24
34
  Do NOT read skill files or workflow documentation before writing code.
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "0.6.0-alpha.32",
2
+ "version": "0.6.0-alpha.34",
3
3
  "description": "FlyDocs Core - Manifest of all managed files",
4
4
  "repository": "github.com/plastrlab/flydocs-core",
5
5