@shiplens/cli 1.4.2 → 1.4.3
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/README.md +30 -30
- package/docs/02_CLI_COMMAND_REFERENCE.md +195 -0
- package/lib/api.js +35 -55
- package/lib/assets/skill.js +137 -139
- package/lib/cli.js +59 -55
- package/lib/commands/auth.js +36 -41
- package/lib/commands/context.js +13 -18
- package/lib/commands/dashboards.js +16 -24
- package/lib/commands/doctor.js +43 -34
- package/lib/commands/heatmap.js +14 -9
- package/lib/commands/init.js +51 -51
- package/lib/commands/mcp.js +2 -2
- package/lib/commands/pages.js +19 -23
- package/lib/commands/projects.js +13 -13
- package/lib/commands/query.js +10 -12
- package/lib/commands/sql.js +4 -5
- package/lib/commands/summary.js +7 -7
- package/lib/injector.js +19 -22
- package/lib/mcp-config.js +5 -5
- package/lib/taxonomy.js +22 -25
- package/package.json +2 -2
- package/prompts/prompts_cli_en.md +743 -0
- package/docs/02_SHIPLENS_CLI_/345/205/250/345/221/275/344/273/244/345/217/202/350/200/203/346/211/213/345/206/214.md +0 -205
package/lib/assets/skill.js
CHANGED
|
@@ -1,204 +1,202 @@
|
|
|
1
1
|
const SKILL_CONTENT = `---
|
|
2
2
|
name: shiplens-analytics
|
|
3
|
-
description: Shiplens Web
|
|
3
|
+
description: Shiplens Web Analytics — Agent behavior protocol, diagnostics, and data analysis execution.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
|
-
# Shiplens Web
|
|
6
|
+
# Shiplens Web Analytics Skill (v3.0)
|
|
7
7
|
|
|
8
|
-
Shiplens
|
|
8
|
+
Shiplens provides web user behavior analytics via CLI and MCP. This document defines how an AI Agent should diagnose, onboard, and analyze data for any project using Shiplens.
|
|
9
9
|
|
|
10
10
|
---
|
|
11
11
|
|
|
12
|
-
## 1.
|
|
12
|
+
## 1. Environment Diagnostics
|
|
13
13
|
|
|
14
|
-
|
|
14
|
+
Before executing any command, check three signals to determine project state:
|
|
15
15
|
|
|
16
|
-
|
|
|
17
|
-
|
|
18
|
-
|
|
|
19
|
-
| **SDK** | \`package.json\`
|
|
20
|
-
|
|
|
16
|
+
| Signal | What to check |
|
|
17
|
+
|--------|---------------|
|
|
18
|
+
| **Auth** | Does \`shiplens.env\` or env var \`SHIPLENS_ACCESS_SECRET\` exist? |
|
|
19
|
+
| **SDK** | Is \`@shiplens/sdk\` in \`package.json\` and instrumented in source? |
|
|
20
|
+
| **Cloud** | Does \`.shiplens.json\` contain a valid \`app_id\`? |
|
|
21
21
|
|
|
22
|
-
###
|
|
22
|
+
### State Matrix
|
|
23
23
|
|
|
24
|
-
|
|
|
25
|
-
|
|
26
|
-
|
|
|
27
|
-
|
|
|
28
|
-
|
|
|
29
|
-
|
|
|
24
|
+
| State | Condition | Action |
|
|
25
|
+
|-------|-----------|--------|
|
|
26
|
+
| **A — Ready** | All three ✓ | Proceed to data analysis (§3) |
|
|
27
|
+
| **A-1 — No project** | Auth ✓, no \`app_id\` | User authenticated, but cloud account has no projects or project is not linked. Guide user to \`shiplens.dev\` to verify account or create a project |
|
|
28
|
+
| **B — No auth / New device** | SDK ✓, Auth ✗ | Missing local \`shiplens.env\`. Ask: *"Have you registered a Shiplens account?"*<br>• **Registered**: Guide user to visit \`https://shiplens.dev/settings/api-keys\`, download the \`shiplens.env\` file and place it in the project root (advanced users can copy the API key and run \`shiplens auth set --secret <key>\`).<br>• **Not registered**: Ask for email and run \`shiplens auth bind --email <email> --json\`. |
|
|
29
|
+
| **C — Cold start** | SDK ✗, Auth ✗ | Run \`shiplens init\` (§2) |
|
|
30
30
|
|
|
31
|
-
|
|
31
|
+
This matrix doubles as the troubleshooting baseline. When anything breaks, trace back through these three signals.
|
|
32
32
|
|
|
33
33
|
---
|
|
34
34
|
|
|
35
|
-
## 2.
|
|
35
|
+
## 2. Project Onboarding
|
|
36
36
|
|
|
37
|
-
###
|
|
37
|
+
### Run
|
|
38
38
|
\`\`\`bash
|
|
39
|
-
npx.cmd --yes @shiplens/cli init --json # Windows
|
|
39
|
+
npx.cmd --yes @shiplens/cli init --json # Windows PowerShell
|
|
40
40
|
npx --yes @shiplens/cli init --json # macOS / Linux
|
|
41
41
|
\`\`\`
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
###
|
|
45
|
-
1.
|
|
46
|
-
2.
|
|
47
|
-
3.
|
|
48
|
-
4.
|
|
49
|
-
5.
|
|
50
|
-
6.
|
|
51
|
-
7.
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
- **零后续摩擦**:本地 Agent **无需执行额外的登录命令或索要 Token**,已写入的 \`shiplens.env\` 即刻生效,后续的数据查询(\`shiplens query\`)与 MCP 服务(\`shiplens mcp serve\`)直接可用。
|
|
68
|
-
|
|
69
|
-
### 汇报模板
|
|
70
|
-
初始化完成后,输出标准卡片:
|
|
42
|
+
Backup mirror fallback: add \`--registry=https://registry.npmmirror.com\`
|
|
43
|
+
|
|
44
|
+
### What init does (~15 seconds, one atomic command)
|
|
45
|
+
1. Detect framework (Next.js / Vite / Vue / HTML)
|
|
46
|
+
2. Install \`@shiplens/sdk\`
|
|
47
|
+
3. Inject tracking code into entry file
|
|
48
|
+
4. Register project via \`POST /api/connect\` → receive \`app_id\` + \`dashboard_url\`
|
|
49
|
+
5. Scan page content → generate \`.shiplens/contexts/<app_id>.md\`
|
|
50
|
+
6. Write local state machine \`.shiplens.json\`
|
|
51
|
+
7. Inject this AI Skill file and Agent rules
|
|
52
|
+
|
|
53
|
+
### Overwrite Protection & Comparison
|
|
54
|
+
If \`.shiplens.json\` or SDK instrumentation already exists, **stop and present the clear comparison**:
|
|
55
|
+
- **Option 1 [Recommended]**: Keep existing statistics. Retain existing project ID and historical data, new traffic continues accumulating on current dashboard.
|
|
56
|
+
- **Option 2 [Overwrite]**: Overwrite with \`--force\`. Request a brand new blank project ID from cloud and overwrite local code (**Note**: Old dashboard will stop receiving new data, old and new data cannot be merged).
|
|
57
|
+
|
|
58
|
+
### Post-Init: Request Email & Seamless Activation
|
|
59
|
+
When \`shiplens auth bind --email <email> --json\` is called:
|
|
60
|
+
1. Server generates device credentials and writes them directly to local \`shiplens.env\` (0600 permissions, auto-gitignored).
|
|
61
|
+
2. Server sends a Magic Link email to the user.
|
|
62
|
+
3. Once the user clicks the email link, the cloud account and device credentials become active immediately.
|
|
63
|
+
4. **Zero extra steps for Agent**: Future queries and \`shiplens mcp serve\` will authenticate automatically without manual login.
|
|
64
|
+
|
|
65
|
+
### Reporting Template
|
|
66
|
+
After init, present:
|
|
71
67
|
|
|
72
68
|
\`\`\`markdown
|
|
73
|
-
### 📊
|
|
74
|
-
-
|
|
75
|
-
-
|
|
76
|
-
-
|
|
77
|
-
-
|
|
78
|
-
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
>
|
|
82
|
-
> **请告诉我您的邮箱**:点击邮件中的链接即可完成注册,激活每月 50,000 事件的免费额度(约5000人访问),同时绑定项目和账号;激活后您与我直接对话,我就有权限查询并分析产品数据。
|
|
69
|
+
### 📊 Project & Analytics Information
|
|
70
|
+
- **Project Name**: \\\`<project_name>\\\`
|
|
71
|
+
- **App ID**: \\\`<app_id>\\\`
|
|
72
|
+
- **Code Injection**: [\\\`<injected_file>\\\`](file:///<path>)
|
|
73
|
+
- **Live Dashboard**: [<dashboard_url>](<dashboard_url>)
|
|
74
|
+
- **Account Status**: <status>
|
|
75
|
+
- **AI Skill**: [\\\`.agents/skills/shiplens/SKILL.md\\\`](file:///<path>)
|
|
76
|
+
|
|
77
|
+
> **Activate your project**: Share your email to activate monthly free event quota and link your project with your account.
|
|
83
78
|
\`\`\`
|
|
84
79
|
|
|
85
|
-
|
|
86
|
-
-
|
|
87
|
-
-
|
|
88
|
-
-
|
|
80
|
+
Account status values:
|
|
81
|
+
- \`Logged in (project linked)\` — credentials exist, project bound
|
|
82
|
+
- \`Logged in (project not linked)\` — credentials exist, project unbound
|
|
83
|
+
- \`Not logged in (Default state after first installation or no valid local credentials)\`
|
|
89
84
|
|
|
90
85
|
---
|
|
91
86
|
|
|
92
|
-
## 3.
|
|
87
|
+
## 3. Data Analysis Protocol (6 Steps)
|
|
93
88
|
|
|
94
|
-
|
|
89
|
+
When the user asks any data or analytics question:
|
|
95
90
|
|
|
96
|
-
|
|
91
|
+
**Step 1 — Check overrides**: Read \`.shiplens/learnings.md\` if it exists. Apply user preferences tailored to specific analysis scenarios (date range, metrics, filters).
|
|
97
92
|
|
|
98
|
-
|
|
93
|
+
**Step 2 — Ground in context**: Read \`.shiplens/contexts/<app_id>.md\` (or \`shiplens context show --json\`). Use real page names and button labels, not raw IDs.
|
|
99
94
|
|
|
100
|
-
|
|
95
|
+
**Step 3 — Find scenario**: Open \`prompts/prompts_cli_en.md\` (or \`_zh.md\`), read the **Scenario Outline** at the top, locate the matching scenario, then read its full execution steps.
|
|
101
96
|
|
|
102
|
-
|
|
97
|
+
**Step 4 — Execute**: Run the prescribed CLI commands with overrides from Step 1 applied.
|
|
103
98
|
|
|
104
|
-
|
|
99
|
+
**Step 5 — Synthesize**: Translate numbers into actionable business insights, grounded in context from Step 2.
|
|
105
100
|
|
|
106
|
-
|
|
101
|
+
**Step 6 — Offer to remember**: If the user corrected your approach (e.g., "always compare 14-day retention for cohorts"), ask: *"Save this preference to \`.shiplens/learnings.md\` for future analyses?"* If yes, write it (§6).
|
|
107
102
|
|
|
108
|
-
###
|
|
109
|
-
-
|
|
110
|
-
-
|
|
103
|
+
### Priority
|
|
104
|
+
- **Priority 1**: \`.shiplens/learnings.md\` — user's project-specific overrides
|
|
105
|
+
- **Priority 2**: \`prompts/prompts_cli_*.md\` — 42 textbook analysis scenarios
|
|
111
106
|
|
|
112
107
|
---
|
|
113
108
|
|
|
114
|
-
## 4.
|
|
115
|
-
|
|
116
|
-
|
|
|
117
|
-
|
|
118
|
-
| \`shiplens init --json\` |
|
|
119
|
-
| \`shiplens doctor --json\` |
|
|
120
|
-
| \`shiplens summary --range 7d --json\` |
|
|
121
|
-
| \`shiplens query --metric <m> --range 7d --json\` |
|
|
122
|
-
| \`shiplens sql --query "<sql>" --json\` |
|
|
123
|
-
| \`shiplens pages --range 7d --json\` |
|
|
124
|
-
| \`shiplens paths --range 7d --json\` |
|
|
125
|
-
| \`shiplens heatmap --template <id> --json\` |
|
|
126
|
-
| \`shiplens dashboards create --title "..." --prompt "..." --json\` | AI
|
|
127
|
-
| \`shiplens context
|
|
128
|
-
| \`shiplens auth bind --email
|
|
129
|
-
| \`shiplens
|
|
130
|
-
| \`shiplens
|
|
131
|
-
| \`shiplens projects delete --app-id <id> --json\` | 删除项目(**高危操作,必须二次确认**,§5) |
|
|
109
|
+
## 4. CLI Commands
|
|
110
|
+
|
|
111
|
+
| Command | Purpose |
|
|
112
|
+
|---------|---------|
|
|
113
|
+
| \`shiplens init --json\` | Project onboarding (§2) |
|
|
114
|
+
| \`shiplens doctor --json\` | Diagnose config, SDK, network, credentials |
|
|
115
|
+
| \`shiplens summary --range 7d --json\` | PV, UV, bounce rate, top geos, devices |
|
|
116
|
+
| \`shiplens query --metric <m> --range 7d --json\` | Multi-dimensional metrics and funnels |
|
|
117
|
+
| \`shiplens sql --query "<sql>" --json\` | Read-only SQL on ClickHouse |
|
|
118
|
+
| \`shiplens pages --range 7d --json\` | Page visits and dwell times |
|
|
119
|
+
| \`shiplens paths --range 7d --json\` | User flow and navigation paths |
|
|
120
|
+
| \`shiplens heatmap --template <id> --json\` | Click heatmaps and skeleton wireframes |
|
|
121
|
+
| \`shiplens dashboards create --title "..." --prompt "..." --json\` | AI-generated dashboards |
|
|
122
|
+
| \`shiplens context show --json\` | Show business context |
|
|
123
|
+
| \`shiplens auth bind --email <email> --json\` | Send Magic Link for activation |
|
|
124
|
+
| \`shiplens mcp serve\` | Start local stdio MCP proxy for IDE/Agent |
|
|
125
|
+
| \`shiplens projects delete --app-id <id> --json\` | Delete project (**requires confirmation**, §5) |
|
|
132
126
|
|
|
133
127
|
---
|
|
134
128
|
|
|
135
|
-
## 5.
|
|
129
|
+
## 5. Safety Rules
|
|
136
130
|
|
|
137
|
-
###
|
|
138
|
-
|
|
139
|
-
1.
|
|
140
|
-
2.
|
|
141
|
-
3.
|
|
142
|
-
4.
|
|
131
|
+
### Project Deletion — Stop and Confirm (HITL)
|
|
132
|
+
Before deleting any project:
|
|
133
|
+
1. Show project name, \`app_id\`, and creation date.
|
|
134
|
+
2. Warn: *"This permanently deletes all data, dashboards, and config. Cannot be undone."*
|
|
135
|
+
3. Explicitly pause and wait for user to reply "confirm delete".
|
|
136
|
+
4. Only then execute \`shiplens projects delete\`.
|
|
143
137
|
|
|
144
|
-
|
|
138
|
+
Never skip this step.
|
|
145
139
|
|
|
146
|
-
### SQL
|
|
147
|
-
-
|
|
148
|
-
-
|
|
149
|
-
-
|
|
140
|
+
### SQL
|
|
141
|
+
- Always \`WHERE timestamp >= now() - INTERVAL <N> DAY\`
|
|
142
|
+
- Always \`LIMIT\` (max 1000)
|
|
143
|
+
- Table: \`events\` (read-only ClickHouse)
|
|
150
144
|
|
|
151
|
-
### Windows
|
|
152
|
-
-
|
|
153
|
-
-
|
|
145
|
+
### Windows Execution Policy
|
|
146
|
+
- Use \`.cmd\` suffix: \`npx.cmd\`, \`npm.cmd\`
|
|
147
|
+
- Chain commands with \`;\` not \`&&\`
|
|
154
148
|
|
|
155
149
|
---
|
|
156
150
|
|
|
157
|
-
## 6.
|
|
151
|
+
## 6. Adaptive Learning (\`.shiplens/learnings.md\`)
|
|
158
152
|
|
|
159
|
-
|
|
153
|
+
Stores user preferences that override defaults. Understand the specific scenario scope (e.g. retention vs. funnel vs. channels) instead of applying narrow rules globally.
|
|
160
154
|
|
|
161
|
-
###
|
|
155
|
+
### Format
|
|
162
156
|
\`\`\`markdown
|
|
163
|
-
# Shiplens
|
|
157
|
+
# Shiplens Project Learnings
|
|
158
|
+
|
|
159
|
+
## Global Overrides
|
|
160
|
+
- default_range: 30d
|
|
161
|
+
- exclude_filter: user_id NOT IN ('test_1', 'test_2')
|
|
164
162
|
|
|
165
|
-
##
|
|
166
|
-
|
|
167
|
-
-
|
|
163
|
+
## Scenario-Specific Overrides
|
|
164
|
+
### Retention Analysis
|
|
165
|
+
- cohort_interval: 14d
|
|
166
|
+
- retention_benchmark: day_1_day_7_day_30
|
|
168
167
|
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
- default_range: 14d # 用户偏好以双周周期评估留存衰减
|
|
172
|
-
- focus_metrics: ["第 14 天留存率", "次周回访率"]
|
|
168
|
+
### Conversion Funnel
|
|
169
|
+
- primary_conversion_goal: /signup → /onboarding → /dashboard
|
|
173
170
|
|
|
174
|
-
###
|
|
175
|
-
-
|
|
176
|
-
-
|
|
171
|
+
### Custom Analysis Habits
|
|
172
|
+
- Always show week-over-week comparison
|
|
173
|
+
- Report bounce rate per page, not aggregate
|
|
177
174
|
\`\`\`
|
|
178
175
|
|
|
179
|
-
###
|
|
180
|
-
-
|
|
181
|
-
-
|
|
182
|
-
-
|
|
176
|
+
### Rules
|
|
177
|
+
- Do **not** create during \`init\`
|
|
178
|
+
- Create on first user-confirmed preference save
|
|
179
|
+
- Scope preferences accurately to avoid inappropriate global overrides
|
|
180
|
+
- Always ask before writing
|
|
183
181
|
|
|
184
182
|
---
|
|
185
183
|
|
|
186
|
-
## 7.
|
|
184
|
+
## 7. SQL Reference
|
|
187
185
|
|
|
188
|
-
|
|
186
|
+
**Table**: \`events\` (ClickHouse, read-only)
|
|
189
187
|
|
|
190
|
-
|
|
|
191
|
-
|
|
192
|
-
| \`timestamp\` | DateTime |
|
|
188
|
+
| Column | Type | Description |
|
|
189
|
+
|--------|------|-------------|
|
|
190
|
+
| \`timestamp\` | DateTime | Event time |
|
|
193
191
|
| \`event_name\` | String | pageview, click, custom |
|
|
194
|
-
| \`user_id\` | String |
|
|
195
|
-
| \`session_id\` | String |
|
|
196
|
-
| \`template_id\` | String | DOM
|
|
197
|
-
| \`page_path\` | String |
|
|
198
|
-
| \`referrer\` | String |
|
|
199
|
-
| \`properties\` | Map(String, String) |
|
|
200
|
-
|
|
201
|
-
ClickHouse
|
|
192
|
+
| \`user_id\` | String | User ID |
|
|
193
|
+
| \`session_id\` | String | Session ID |
|
|
194
|
+
| \`template_id\` | String | DOM hash (page template) |
|
|
195
|
+
| \`page_path\` | String | URL path |
|
|
196
|
+
| \`referrer\` | String | Referrer URL |
|
|
197
|
+
| \`properties\` | Map(String, String) | Custom event data |
|
|
198
|
+
|
|
199
|
+
ClickHouse functions: \`countIf()\`, \`quantile(0.50)()\`, \`dateDiff()\`, \`uniq()\`.
|
|
202
200
|
`;
|
|
203
201
|
|
|
204
202
|
module.exports = { SKILL_CONTENT };
|
package/lib/cli.js
CHANGED
|
@@ -15,7 +15,11 @@ const { handleDoctor } = require('./commands/doctor');
|
|
|
15
15
|
const { handleContext } = require('./commands/context');
|
|
16
16
|
const { handleMcp } = require('./commands/mcp');
|
|
17
17
|
|
|
18
|
-
|
|
18
|
+
let VERSION = '1.3.0';
|
|
19
|
+
try {
|
|
20
|
+
const pkg = require('../package.json');
|
|
21
|
+
if (pkg.version) VERSION = pkg.version;
|
|
22
|
+
} catch (e) {}
|
|
19
23
|
|
|
20
24
|
function parseArgs(argv) {
|
|
21
25
|
const flags = {};
|
|
@@ -65,61 +69,61 @@ function parseArgs(argv) {
|
|
|
65
69
|
}
|
|
66
70
|
|
|
67
71
|
function printHelp() {
|
|
68
|
-
console.log(`Shiplens CLI
|
|
72
|
+
console.log(`Shiplens CLI - High-Speed User Telemetry & SDK Management Tool (v${VERSION})
|
|
69
73
|
|
|
70
|
-
|
|
71
|
-
shiplens
|
|
72
|
-
npx.cmd --yes shiplens-cli
|
|
73
|
-
npx --yes shiplens-cli
|
|
74
|
+
Usage:
|
|
75
|
+
shiplens <command> [subcommand] [options]
|
|
76
|
+
npx.cmd --yes shiplens-cli <command> [subcommand] [options] (Windows)
|
|
77
|
+
npx --yes shiplens-cli <command> [subcommand] [options] (macOS/Linux)
|
|
74
78
|
|
|
75
|
-
|
|
76
|
-
init
|
|
77
|
-
auth
|
|
78
|
-
projects
|
|
79
|
-
query
|
|
80
|
-
sql
|
|
81
|
-
summary
|
|
82
|
-
pages
|
|
83
|
-
paths
|
|
84
|
-
canvas
|
|
85
|
-
heatmap
|
|
86
|
-
dashboards AI
|
|
87
|
-
doctor
|
|
88
|
-
context
|
|
89
|
-
mcp serve
|
|
79
|
+
Core Commands:
|
|
80
|
+
init 15-second zero-config analytics initialization & dashboard setup
|
|
81
|
+
auth Authentication & credentials (status, set, secret, whoami, logout, bind, mcp-config, configure)
|
|
82
|
+
projects Project management (list, bind, delete)
|
|
83
|
+
query Multi-dimensional metrics and conversion funnel queries
|
|
84
|
+
sql Execute secure read-only SQL queries on ClickHouse
|
|
85
|
+
summary Retrieve product overview (traffic, bounce rates, geos, devices)
|
|
86
|
+
pages Inspect page-level visits and average dwell times
|
|
87
|
+
paths Analyze user flow journeys and Sankey transition paths
|
|
88
|
+
canvas Retrieve global user behavior canvas topology
|
|
89
|
+
heatmap Retrieve click heatmaps and skeleton wireframes
|
|
90
|
+
dashboards AI dashboard management and one-click creation (list, create [--ai])
|
|
91
|
+
doctor Run full end-to-end diagnostics on SDK, credentials, and network
|
|
92
|
+
context Manage business context dictionary (push, pull, show)
|
|
93
|
+
mcp serve Run local MCP proxy server with device credentials
|
|
90
94
|
|
|
91
|
-
auth
|
|
92
|
-
auth status
|
|
93
|
-
auth set [--secret-stdin]
|
|
94
|
-
auth secret list
|
|
95
|
-
auth secret create [--scopes ...]
|
|
96
|
-
auth secret revoke --key-id <id>
|
|
97
|
-
auth whoami
|
|
98
|
-
auth logout
|
|
99
|
-
auth bind --email
|
|
100
|
-
auth mcp-config [--client <client>]
|
|
101
|
-
auth configure --client <client>
|
|
102
|
-
auth configure --client manual
|
|
95
|
+
auth Subcommands:
|
|
96
|
+
auth status Check credential validity
|
|
97
|
+
auth set [--secret-stdin] Save Access Secret
|
|
98
|
+
auth secret list List Access Secrets (masked)
|
|
99
|
+
auth secret create [--scopes ...] Create scoped offline Access Secret
|
|
100
|
+
auth secret revoke --key-id <id> Revoke offline Access Secret
|
|
101
|
+
auth whoami Display current authenticated user
|
|
102
|
+
auth logout Clear local credentials
|
|
103
|
+
auth bind --email <email> [--json] Send Magic Link email for account binding
|
|
104
|
+
auth mcp-config [--client <client>] Print MCP configuration (cursor/codex/claude/antigravity/manual)
|
|
105
|
+
auth configure --client <client> Write MCP configuration into target client
|
|
106
|
+
auth configure --client manual Output standard MCP JSON configuration
|
|
103
107
|
|
|
104
|
-
init
|
|
105
|
-
--name <string>
|
|
106
|
-
--description <string>
|
|
107
|
-
--genre <id> Level 1
|
|
108
|
-
--subgenre <id> Level 2
|
|
109
|
-
--tags <ids> Level 4
|
|
110
|
-
--industry <string>
|
|
111
|
-
--email <email|auto>
|
|
108
|
+
init Dedicated Options:
|
|
109
|
+
--name <string> Project name (default: auto-read from package.json)
|
|
110
|
+
--description <string> Project functional description & positioning
|
|
111
|
+
--genre <id> Level 1 category ID (e.g. utilities, finance, casual_games)
|
|
112
|
+
--subgenre <id> Level 2 subcategory ID (e.g. developer_tools, financial_tools)
|
|
113
|
+
--tags <ids> Level 4 feature tags (comma-separated tag_ids)
|
|
114
|
+
--industry <string> Compatibility industry category field
|
|
115
|
+
--email <email|auto> Auto or manual binding email
|
|
112
116
|
|
|
113
|
-
|
|
114
|
-
--json
|
|
115
|
-
--force
|
|
116
|
-
--no-commit
|
|
117
|
-
--app-id <id>
|
|
118
|
-
--env <env>
|
|
119
|
-
--secret <key>
|
|
120
|
-
--api-url <url>
|
|
121
|
-
-v, --version
|
|
122
|
-
-h, --help
|
|
117
|
+
Global Options:
|
|
118
|
+
--json Output in standard JSON format (required for AI Agents)
|
|
119
|
+
--force Force overwrite existing local configuration and project ID
|
|
120
|
+
--no-commit Skip automatic Git commit after initialization
|
|
121
|
+
--app-id <id> Explicitly specify target project app_id
|
|
122
|
+
--env <env> Target environment (production / staging, default: production)
|
|
123
|
+
--secret <key> Pass Access Secret explicitly
|
|
124
|
+
--api-url <url> Custom backend API base URL (default: http://120.26.230.33)
|
|
125
|
+
-v, --version Display CLI version
|
|
126
|
+
-h, --help Display help information
|
|
123
127
|
`);
|
|
124
128
|
}
|
|
125
129
|
|
|
@@ -162,12 +166,12 @@ async function runCLI(argv = process.argv.slice(2)) {
|
|
|
162
166
|
status: err.status,
|
|
163
167
|
}, null, 2));
|
|
164
168
|
} else {
|
|
165
|
-
console.error(`❌
|
|
169
|
+
console.error(`❌ Error [${code}]: ${err.message}`);
|
|
166
170
|
}
|
|
167
171
|
process.exitCode = 1;
|
|
168
172
|
};
|
|
169
173
|
|
|
170
|
-
//
|
|
174
|
+
// Resolve credentials and API client
|
|
171
175
|
const resolvedAuth = resolveSecret(flags.secret);
|
|
172
176
|
let apiUrl = flags['api-url'] || process.env.SHIPLENS_API_URL;
|
|
173
177
|
if (!apiUrl) {
|
|
@@ -182,7 +186,7 @@ async function runCLI(argv = process.argv.slice(2)) {
|
|
|
182
186
|
if (flags['app-id']) return flags['app-id'];
|
|
183
187
|
const localCfg = getLocalConfig();
|
|
184
188
|
if (localCfg && localCfg.app_id) return localCfg.app_id;
|
|
185
|
-
const err = new Error('
|
|
189
|
+
const err = new Error('Target app_id not found. Provide --app-id or run inside an initialized project directory.');
|
|
186
190
|
err.code = 'APP_NOT_FOUND';
|
|
187
191
|
throw err;
|
|
188
192
|
};
|
|
@@ -244,7 +248,7 @@ async function runCLI(argv = process.argv.slice(2)) {
|
|
|
244
248
|
await handleMcp(subcommand || 'serve');
|
|
245
249
|
break;
|
|
246
250
|
default:
|
|
247
|
-
throw new Error(
|
|
251
|
+
throw new Error(`Unknown command: ${command}. Use shiplens --help to view supported commands.`);
|
|
248
252
|
}
|
|
249
253
|
} catch (err) {
|
|
250
254
|
outputError(err);
|