feedbackbasket-cli 0.9.0 → 0.9.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 CHANGED
@@ -41,6 +41,8 @@ feedbackbasket feedback update <id> --status PLANNED --agent
41
41
  feedbackbasket widget script myproject --agent
42
42
  ```
43
43
 
44
+ When installing or configuring a widget for the current app, agents should not rely on the CLI default project. First run `feedbackbasket projects list --agent`, match the current app by its real website URL or clearly matching project name, and only create a new project after confirming no existing project belongs to this app. If the only known URL is `localhost`, ask for the production, staging, preview, or intended public URL before creating the project.
45
+
44
46
  ### Install Claude Code Skill
45
47
 
46
48
  ```bash
@@ -70,11 +72,14 @@ All project commands accept **name or ID** (e.g. `feedbackbasket` or `cmn3c7sgv.
70
72
  feedbackbasket projects list # List all projects with stats
71
73
  feedbackbasket projects show <name-or-id> # Project details
72
74
  feedbackbasket projects create "My App" --url https://... # Create project
75
+ feedbackbasket projects create "Local Test" --url http://localhost:3000 --allow-local-url
73
76
  feedbackbasket projects update myapp --name "New Name" # Update project
74
77
  feedbackbasket projects update myapp --reply-to vlad@example.com # Set default reply-to email
75
78
  feedbackbasket projects delete myapp # Delete (with confirmation)
76
79
  ```
77
80
 
81
+ Use the production, staging, preview, or intended public website URL for projects. The CLI blocks accidental `localhost`/loopback URLs in agent and non-interactive mode unless you pass `--allow-local-url` for an explicitly local-only test project.
82
+
78
83
  ### Feedback
79
84
 
80
85
  ```bash
@@ -128,21 +133,33 @@ feedbackbasket widget settings myapp --color "#22c55e" --label "Send Feedback"
128
133
  feedbackbasket widget settings myapp --position bottom-left --display modal
129
134
  feedbackbasket widget settings myapp --email-required --intro "How can we improve?"
130
135
  feedbackbasket widget settings myapp --button-radius 10 --button-size regular
131
- feedbackbasket widget settings myapp --show-email --allow-attachments --guided
136
+ feedbackbasket widget settings myapp --show-email --allow-attachments
132
137
  feedbackbasket widget settings myapp --email-read-only --hide-email-when-prefilled
133
138
 
134
139
  # Configure guided feedback types and follow-up questions
135
140
  feedbackbasket widget flow myapp
136
- feedbackbasket widget flow myapp --enable
137
- feedbackbasket widget flow myapp --reset-default --enable
141
+ feedbackbasket widget flow myapp --enable # guided only when requested
142
+ feedbackbasket widget flow myapp --reset-default --enable # guided only when requested
138
143
  feedbackbasket widget flow myapp --config ./feedback-flow.json
139
144
 
140
145
  # Get embed code (ready to paste into your HTML)
141
146
  feedbackbasket widget script myapp
142
147
  ```
143
148
 
149
+ For inline trigger mode, load the widget once and call the public API from your own button:
150
+
151
+ ```html
152
+ <button onclick="window.FeedbackWidget.openFeedbackForm({ trigger: event.currentTarget })">
153
+ Feedback
154
+ </button>
155
+ ```
156
+
157
+ Passing the trigger element lets popup mode open beside your custom button. Calling `window.FeedbackWidget.openFeedbackForm()` with no arguments still uses the configured widget position.
158
+
144
159
  Use `--email-read-only` and `--hide-email-when-prefilled` with runtime `userEmail` values from your app. These settings do not store visitor emails in FeedbackBasket widget settings.
145
160
 
161
+ The default widget experience is a basic modal. Only switch to popup mode or enable guided feedback when you intentionally want that flow.
162
+
146
163
  `widget flow --config` accepts either a `feedbackFlow` object or a JSON object with a `feedbackFlow` key. V1 supports guided mode with `text`, `textarea`, and `single_choice` follow-up questions.
147
164
 
148
165
  ```json
@@ -59,9 +59,11 @@ export function createProjectsCommand(getWriter) {
59
59
  .description('Create a new project')
60
60
  .requiredOption('--url <url>', 'Project URL')
61
61
  .option('--description <text>', 'Project description')
62
+ .option('--allow-local-url', 'Allow localhost URLs for local-only test projects')
62
63
  .action(async (name, opts) => {
63
64
  const writer = getWriter();
64
65
  const client = requireClient();
66
+ await ensureProjectUrlIsIntentional(opts.url, writer, Boolean(opts.allowLocalUrl));
65
67
  const result = await client.createProject({
66
68
  name,
67
69
  url: opts.url,
@@ -89,6 +91,7 @@ export function createProjectsCommand(getWriter) {
89
91
  .option('--url <url>', 'New project URL')
90
92
  .option('--description <text>', 'New project description')
91
93
  .option('--reply-to <email>', 'Default reply-to email for feedback replies (empty string to clear)')
94
+ .option('--allow-local-url', 'Allow localhost URLs for local-only test projects')
92
95
  .action(async (idOrName, opts) => {
93
96
  const writer = getWriter();
94
97
  if (!opts.name &&
@@ -100,6 +103,9 @@ export function createProjectsCommand(getWriter) {
100
103
  const client = requireClient();
101
104
  const resolved = await resolveProject(client, idOrName);
102
105
  const id = resolved.id;
106
+ if (opts.url) {
107
+ await ensureProjectUrlIsIntentional(opts.url, writer, Boolean(opts.allowLocalUrl));
108
+ }
103
109
  const data = {};
104
110
  if (opts.name)
105
111
  data['name'] = opts.name;
@@ -225,3 +231,32 @@ function renderProjectDetail(project) {
225
231
  }
226
232
  console.log();
227
233
  }
234
+ async function ensureProjectUrlIsIntentional(url, writer, allowLocalUrl) {
235
+ if (!isLocalProjectUrl(url) || allowLocalUrl)
236
+ return;
237
+ const message = 'Project URL looks like a local development address. Use the production, staging, preview, or intended public website URL, or pass --allow-local-url for a local-only test project.';
238
+ if (writer.isMachineOutput() || !process.stdin.isTTY) {
239
+ throw errUsage(message, 'Example: feedbackbasket projects create "My App" --url https://myapp.com');
240
+ }
241
+ console.log(` ${brand.warning('Warning:')} ${message}`);
242
+ console.log();
243
+ const confirmed = await confirm(' Use this as a local-only test project URL?', false);
244
+ if (!confirmed) {
245
+ throw errUsage('Project URL change cancelled. Re-run with the real website URL.', 'Example: feedbackbasket projects create "My App" --url https://myapp.com');
246
+ }
247
+ }
248
+ function isLocalProjectUrl(input) {
249
+ try {
250
+ const url = new URL(input);
251
+ const hostname = url.hostname.toLowerCase();
252
+ return (hostname === 'localhost' ||
253
+ hostname === '127.0.0.1' ||
254
+ hostname === '0.0.0.0' ||
255
+ hostname === '::1' ||
256
+ hostname === '[::1]' ||
257
+ hostname.endsWith('.localhost'));
258
+ }
259
+ catch {
260
+ return false;
261
+ }
262
+ }
@@ -153,7 +153,7 @@ export function createWidgetCommand(getWriter) {
153
153
  breadcrumbs: [
154
154
  { action: 'Get embed code', cmd: `feedbackbasket widget script ${projectId}` },
155
155
  { action: 'View settings', cmd: `feedbackbasket widget settings ${projectId}` },
156
- { action: 'Configure guided questions', cmd: `feedbackbasket widget flow ${projectId} --enable` },
156
+ { action: 'Configure guided questions', cmd: `feedbackbasket widget flow ${projectId}` },
157
157
  ],
158
158
  });
159
159
  }
@@ -167,7 +167,7 @@ export function createWidgetCommand(getWriter) {
167
167
  summary: `Widget settings for "${result.projectName}"`,
168
168
  breadcrumbs: [
169
169
  { action: 'Update color', cmd: `feedbackbasket widget settings ${projectId} --color "#22c55e"` },
170
- { action: 'Enable guided flow', cmd: `feedbackbasket widget flow ${projectId} --enable` },
170
+ { action: 'View guided flow', cmd: `feedbackbasket widget flow ${projectId}` },
171
171
  { action: 'Get embed code', cmd: `feedbackbasket widget script ${projectId}` },
172
172
  ],
173
173
  });
@@ -227,8 +227,8 @@ export function createWidgetCommand(getWriter) {
227
227
  writer.ok(result.settings.feedbackFlow ?? DEFAULT_FEEDBACK_FLOW, {
228
228
  summary: `Guided feedback flow for "${result.projectName}"`,
229
229
  breadcrumbs: [
230
- { action: 'Enable guided flow', cmd: `feedbackbasket widget flow ${projectId} --enable` },
231
- { action: 'Reset templates', cmd: `feedbackbasket widget flow ${projectId} --reset-default --enable` },
230
+ { action: 'Enable guided flow if requested', cmd: `feedbackbasket widget flow ${projectId} --enable` },
231
+ { action: 'Reset templates if requested', cmd: `feedbackbasket widget flow ${projectId} --reset-default --enable` },
232
232
  { action: 'Apply JSON config', cmd: `feedbackbasket widget flow ${projectId} --config ./feedback-flow.json` },
233
233
  ],
234
234
  });
@@ -243,6 +243,7 @@ export function createWidgetCommand(getWriter) {
243
243
  const projectId = await resolveProjectId(client, projectArg);
244
244
  const result = await client.getWidgetScript(projectId);
245
245
  if (!writer.isMachineOutput()) {
246
+ const settingsResult = await client.getWidgetSettings(projectId);
246
247
  console.log(brand.bold(`Widget embed code for ${result.projectName}`));
247
248
  console.log(divider(50));
248
249
  console.log();
@@ -252,6 +253,7 @@ export function createWidgetCommand(getWriter) {
252
253
  console.log();
253
254
  console.log(brand.muted(` Script URL: ${result.scriptUrl}`));
254
255
  console.log();
256
+ renderInlineTriggerHelp(settingsResult.settings);
255
257
  }
256
258
  writer.ok(result, {
257
259
  summary: `Embed code for "${result.projectName}"`,
@@ -341,6 +343,27 @@ function isRecord(value) {
341
343
  function stringValue(value) {
342
344
  return typeof value === 'string' ? value.trim() : '';
343
345
  }
346
+ function renderInlineTriggerHelp(settings) {
347
+ if (settings.triggerMode !== 'inline')
348
+ return;
349
+ console.log(brand.bold('Custom inline trigger'));
350
+ console.log(divider(50));
351
+ console.log();
352
+ console.log(brand.muted(' Call this from your own button:'));
353
+ console.log();
354
+ console.log(` ${brand.primary('<button onclick="window.FeedbackWidget.openFeedbackForm({ trigger: event.currentTarget })">')}`);
355
+ console.log(` ${brand.primary(' Feedback')}`);
356
+ console.log(` ${brand.primary('</button>')}`);
357
+ console.log();
358
+ if (settings.displayMode === 'popup') {
359
+ console.log(brand.muted(' Passing the trigger keeps popup mode anchored beside your custom button.'));
360
+ }
361
+ else {
362
+ console.log(brand.muted(' Modal mode stays centered; passing the trigger is safe for future popup changes.'));
363
+ }
364
+ console.log(brand.muted(' Existing calls to window.FeedbackWidget.openFeedbackForm() still work.'));
365
+ console.log();
366
+ }
344
367
  function renderWidgetSettings(projectName, settings) {
345
368
  console.log(brand.bold(`Widget settings — ${projectName}`));
346
369
  console.log(divider(40));
package/dist/src/help.js CHANGED
@@ -61,7 +61,7 @@ export function renderRootHelp() {
61
61
  lines.push(`${INDENT}${brand.muted('$')} feedbackbasket feedback list --category BUG --status OPEN`);
62
62
  lines.push(`${INDENT}${brand.muted('$')} feedbackbasket bugs list --severity high`);
63
63
  lines.push(`${INDENT}${brand.muted('$')} feedbackbasket widget script myapp`);
64
- lines.push(`${INDENT}${brand.muted('$')} feedbackbasket widget flow myapp --reset-default --enable`);
64
+ lines.push(`${INDENT}${brand.muted('$')} feedbackbasket widget settings myapp --display modal`);
65
65
  lines.push(`${INDENT}${brand.muted('$')} feedbackbasket projects create "My App" --url https://myapp.com`);
66
66
  lines.push('');
67
67
  // Learn More
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "0.9.0";
2
- export declare const USER_AGENT = "FeedbackBasket-CLI/0.9.0";
1
+ export declare const VERSION = "0.9.3";
2
+ export declare const USER_AGENT = "FeedbackBasket-CLI/0.9.3";
@@ -1,2 +1,2 @@
1
- export const VERSION = '0.9.0';
1
+ export const VERSION = '0.9.3';
2
2
  export const USER_AGENT = `FeedbackBasket-CLI/${VERSION}`;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "feedbackbasket-cli",
3
- "version": "0.9.0",
3
+ "version": "0.9.3",
4
4
  "description": "Command-line interface for FeedbackBasket — manage feedback from your terminal",
5
5
  "type": "module",
6
6
  "main": "dist/src/cli.js",
@@ -53,6 +53,16 @@ feedbackbasket projects delete <name-or-id> --yes
53
53
 
54
54
  All project commands accept **name or ID**. Names are matched case-insensitively with fuzzy suggestions on typos.
55
55
 
56
+ **Project selection rule for widget installs:** when the user asks to add a FeedbackBasket widget, bubble, popup, modal, or feedback button to the current app, first resolve the FeedbackBasket project for this app. Do not use the CLI default project just because one is configured.
57
+
58
+ 1. Identify the current app's real website URL or intended public URL from the user, app config, docs, or existing FeedbackBasket embed code.
59
+ 2. Run `feedbackbasket projects list --agent` and look for an existing project whose `url` matches that site or whose name clearly matches the current app.
60
+ 3. If exactly one project matches, use that project ID/name for `widget settings`, `widget script`, and feedback commands.
61
+ 4. If multiple projects could match, ask the user which one to use.
62
+ 5. If no project matches, ask whether to create a new project for this app, then create it with the confirmed real URL. Do not create a project from a localhost URL unless the user explicitly wants a local-only test project.
63
+
64
+ **Project URL rule for agents:** confirm the real website URL before creating or updating a project. Never use `localhost`, `127.0.0.1`, `0.0.0.0`, `::1`, or a local dev server URL unless the user explicitly says the project is only for local testing. If the repo only exposes a local URL, ask for the production, staging, preview, or intended public URL. Do not guess a public domain from package names, git remotes, or environment variables. For an explicitly local-only test project, pass `--allow-local-url`.
65
+
56
66
  ### Feedback
57
67
  ```bash
58
68
  # Read
@@ -99,19 +109,39 @@ feedbackbasket widget settings <project>
99
109
  feedbackbasket widget settings <project> --color "#22c55e" --label "Send Feedback"
100
110
  feedbackbasket widget settings <project> --position bottom-left --display modal
101
111
  feedbackbasket widget settings <project> --email-required --intro "How can we improve?"
102
- feedbackbasket widget settings <project> --show-email --allow-attachments --guided
112
+ feedbackbasket widget settings <project> --show-email --allow-attachments
103
113
  feedbackbasket widget settings <project> --email-read-only --hide-email-when-prefilled
104
114
 
105
115
  # Guided feedback types and follow-up questions
106
116
  feedbackbasket widget flow <project>
107
- feedbackbasket widget flow <project> --enable
108
- feedbackbasket widget flow <project> --reset-default --enable
117
+ feedbackbasket widget flow <project> --enable # only when the user chooses guided feedback
118
+ feedbackbasket widget flow <project> --reset-default --enable # only when the user chooses guided feedback
109
119
  feedbackbasket widget flow <project> --config ./feedback-flow.json
110
120
  ```
111
121
 
122
+ For inline trigger mode, load the widget once and call the public API from the host app's custom button:
123
+
124
+ ```html
125
+ <button onclick="window.FeedbackWidget.openFeedbackForm({ trigger: event.currentTarget })">
126
+ Feedback
127
+ </button>
128
+ ```
129
+
130
+ In React:
131
+
132
+ ```tsx
133
+ <button onClick={(event) => window.FeedbackWidget.openFeedbackForm({ trigger: event.currentTarget })}>
134
+ Feedback
135
+ </button>
136
+ ```
137
+
138
+ Passing the trigger element lets popup mode open beside the custom button. Calling `window.FeedbackWidget.openFeedbackForm()` with no arguments still uses the configured widget position.
139
+
112
140
  `email-read-only` and `hide-email-when-prefilled` control behavior only when the host app passes a runtime `userEmail` value. Do not store visitor emails in widget settings.
113
141
 
114
- `widget flow --config` accepts either a `feedbackFlow` object or a JSON object with a `feedbackFlow` key. Use it when an agent needs to customize visitor choices such as Bug report, Feature request, and General feedback. Supported v1 question types are `text`, `textarea`, and `single_choice`.
142
+ Use the basic widget experience by default: `displayMode` stays `modal`, and guided feedback stays disabled. Ask the user before switching to `popup` or enabling guided feedback. If the user does not care, keep modal + basic feedback.
143
+
144
+ `widget flow --config` accepts either a `feedbackFlow` object or a JSON object with a `feedbackFlow` key. Use it only when the user wants to customize visitor choices such as Bug report, Feature request, and General feedback. Supported v1 question types are `text`, `textarea`, and `single_choice`.
115
145
 
116
146
  ### Team
117
147
  ```bash
@@ -128,14 +158,18 @@ feedbackbasket setup claude # Install this skill for Claude Code
128
158
 
129
159
  ## Common Agent Workflows
130
160
 
131
- ### Set up a new project end-to-end
161
+ ### Add a widget to the current app
132
162
  ```bash
163
+ # First resolve the project for this app. Do not rely on the CLI default project.
164
+ feedbackbasket projects list --agent
165
+
166
+ # If no existing project matches the current app's real URL/name, create one after confirming the URL.
133
167
  feedbackbasket projects create "My App" --url https://myapp.com --agent
134
168
  feedbackbasket widget script "My App" --agent
135
169
  # Agent gets the embed code, adds it to the HTML
136
170
  feedbackbasket widget settings "My App" --color "#22c55e" --label "Feedback" --agent
137
- # Optional: enable the guided wizard with Bug, Feature, and General templates
138
- feedbackbasket widget flow "My App" --reset-default --enable --agent
171
+ # Optional, only when requested: enable the guided wizard with Bug, Feature, and General templates
172
+ # feedbackbasket widget flow "My App" --reset-default --enable --agent
139
173
  ```
140
174
 
141
175
  ### Triage new feedback
@@ -158,6 +192,39 @@ feedbackbasket feedback create "Login button is broken" \
158
192
  ```
159
193
  Agent mode returns the created feedback ID, dashboard URL, and feedback object. Created feedback is analyzed by AI and follows the project's notification settings.
160
194
 
195
+ ### File agent-found issues in FeedbackBasket
196
+
197
+ When the user says "file this in FeedbackBasket", "log this bug", "create feedback for this issue", "add this to FeedbackBasket", or similar, create a concise feedback item for the issue the agent found.
198
+
199
+ Before creating the item, resolve the target project:
200
+
201
+ 1. If the user explicitly names a FeedbackBasket project, use that project.
202
+ 2. If the current repo/app clearly matches exactly one FeedbackBasket project name or project URL from `feedbackbasket projects list --agent`, use that project.
203
+ 3. If the CLI default project clearly matches the current repo/app, use it.
204
+ 4. If multiple projects are plausible, ask the user which FeedbackBasket project to file it under.
205
+ 5. Do not silently guess the project when it is ambiguous.
206
+
207
+ Keep agent-filed feedback short and dashboard-friendly:
208
+
209
+ - Title: under 80 characters, action-oriented, no stack traces.
210
+ - Content: 1 to 3 short paragraphs, ideally under 600 characters, focused on the user-visible problem, expected behavior, and actual behavior.
211
+ - Do not paste long logs, full reasoning chains, or broad investigation notes into the body.
212
+ - Put structured context in metadata: `source=agent`, `found_by=<agent>`, `repo=<name>`, `branch=<branch>`, `route=<path>`, `file=<path>`, `severity=<low|medium|high>`, `test=<command>`.
213
+
214
+ Use:
215
+
216
+ ```bash
217
+ feedbackbasket feedback create "<short title>" \
218
+ --content "<brief user-visible issue description>" \
219
+ --project <project-name-or-id> \
220
+ --type bug \
221
+ --metadata source=agent \
222
+ --metadata found_by=codex \
223
+ --agent
224
+ ```
225
+
226
+ After creation, report the feedback ID and dashboard URL to the user.
227
+
161
228
  ### Investigate high-priority bugs
162
229
  ```bash
163
230
  feedbackbasket bugs list --severity high --agent