@extenshi/mcp 0.7.0 → 0.9.0

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 (69) hide show
  1. package/README.md +9 -4
  2. package/dist/bff.d.ts +17 -0
  3. package/dist/bff.d.ts.map +1 -1
  4. package/dist/bff.js +4 -0
  5. package/dist/bff.js.map +1 -1
  6. package/dist/development-guide.d.ts +109 -79
  7. package/dist/development-guide.d.ts.map +1 -1
  8. package/dist/development-guide.js +133 -45
  9. package/dist/development-guide.js.map +1 -1
  10. package/dist/docs.d.ts +45 -4
  11. package/dist/docs.d.ts.map +1 -1
  12. package/dist/docs.js +162 -17
  13. package/dist/docs.js.map +1 -1
  14. package/dist/icon-workflow.d.ts +5 -4
  15. package/dist/icon-workflow.d.ts.map +1 -1
  16. package/dist/icon-workflow.js +33 -32
  17. package/dist/icon-workflow.js.map +1 -1
  18. package/dist/json-ld.d.ts +89 -0
  19. package/dist/json-ld.d.ts.map +1 -0
  20. package/dist/json-ld.js +118 -0
  21. package/dist/json-ld.js.map +1 -0
  22. package/dist/landing-page.d.ts +123 -0
  23. package/dist/landing-page.d.ts.map +1 -0
  24. package/dist/landing-page.js +405 -0
  25. package/dist/landing-page.js.map +1 -0
  26. package/dist/landing-workflow.d.ts +49 -0
  27. package/dist/landing-workflow.d.ts.map +1 -0
  28. package/dist/landing-workflow.js +80 -0
  29. package/dist/landing-workflow.js.map +1 -0
  30. package/dist/localize-workflow.d.ts +6 -1
  31. package/dist/localize-workflow.d.ts.map +1 -1
  32. package/dist/localize-workflow.js +65 -47
  33. package/dist/localize-workflow.js.map +1 -1
  34. package/dist/pay.d.ts +1 -1
  35. package/dist/pay.d.ts.map +1 -1
  36. package/dist/pay.js +11 -11
  37. package/dist/pay.js.map +1 -1
  38. package/dist/privacy-ai-outcome.d.ts +21 -0
  39. package/dist/privacy-ai-outcome.d.ts.map +1 -0
  40. package/dist/privacy-ai-outcome.js +69 -0
  41. package/dist/privacy-ai-outcome.js.map +1 -0
  42. package/dist/scan.d.ts +7 -0
  43. package/dist/scan.d.ts.map +1 -1
  44. package/dist/scan.js +26 -2
  45. package/dist/scan.js.map +1 -1
  46. package/dist/search-filters.js +1 -1
  47. package/dist/search-filters.js.map +1 -1
  48. package/dist/shape.d.ts +34 -0
  49. package/dist/shape.d.ts.map +1 -1
  50. package/dist/shape.js +150 -3
  51. package/dist/shape.js.map +1 -1
  52. package/dist/telemetry.d.ts.map +1 -1
  53. package/dist/telemetry.js +3 -0
  54. package/dist/telemetry.js.map +1 -1
  55. package/dist/templates.js +5 -5
  56. package/dist/templates.js.map +1 -1
  57. package/dist/tools.d.ts +2 -1
  58. package/dist/tools.d.ts.map +1 -1
  59. package/dist/tools.js +398 -115
  60. package/dist/tools.js.map +1 -1
  61. package/dist/welcome-agent-brief.d.ts +9 -9
  62. package/dist/welcome-agent-brief.d.ts.map +1 -1
  63. package/dist/welcome-agent-brief.js +32 -32
  64. package/dist/welcome-agent-brief.js.map +1 -1
  65. package/dist/welcome-workflow.d.ts +5 -5
  66. package/dist/welcome-workflow.d.ts.map +1 -1
  67. package/dist/welcome-workflow.js +13 -14
  68. package/dist/welcome-workflow.js.map +1 -1
  69. package/package.json +3 -2
@@ -4,21 +4,21 @@ export const DEVELOPMENT_GUIDE_URL = docs('development-workflow');
4
4
  export const DEVELOPMENT_SERVICES = [
5
5
  {
6
6
  id: 'documentation',
7
- purpose: 'Discover capabilities, extension shapes, exact CLI commands and reusable agent skills.',
7
+ purpose: 'Capabilities, extension shapes, exact CLI commands and reusable skill packages.',
8
8
  tools: ['get_development_guide', 'search_docs', 'list_extension_templates'],
9
- access: 'Free guidance; no API key. Hosted transport still requires connector sign-in.',
9
+ access: 'Free reference; no API key. Hosted transport still requires connector sign-in.',
10
10
  urls: [docs('mcp'), DEVELOPMENT_GUIDE_URL, docs('agent-skills')],
11
11
  },
12
12
  {
13
13
  id: 'account',
14
- purpose: 'Sign in, provision an API key for local tools and check credit pools before paid work.',
14
+ purpose: 'Sign-in, API keys for local tools and credit-pool balances ahead of paid work.',
15
15
  tools: ['get_credit_balance', 'connection_diagnostics'],
16
16
  access: 'Balance lookup is free and requires identity; catalog reads and scans use credit pools.',
17
17
  urls: [docs('scan-credits'), 'https://dojo.extenshi.io/api-keys', 'https://dojo.extenshi.io/billing'],
18
18
  },
19
19
  {
20
20
  id: 'research',
21
- purpose: 'Validate demand, competitors, user complaints, permissions and existing security findings.',
21
+ purpose: 'Demand, competitors, user complaints, permissions and existing security findings.',
22
22
  tools: [
23
23
  'search_extensions',
24
24
  'get_extension',
@@ -27,12 +27,12 @@ export const DEVELOPMENT_SERVICES = [
27
27
  'get_risk_by_store_ids',
28
28
  'market_overview',
29
29
  ],
30
- access: 'Identity required. Catalog tools cost 1 read per call; get_security costs 3. Bulk risk: up to 40 per call. Chrome review text is unavailable; use its aggregate.',
30
+ access: 'Identity required. Catalog tools cost 1 read per call; get_security costs 3. Bulk risk: up to 40 per call. Chrome review text is unavailable; its aggregate rating is available.',
31
31
  urls: [docs('mcp'), 'https://catalog.extenshi.io'],
32
32
  },
33
33
  {
34
34
  id: 'projects',
35
- purpose: 'Read an existing project, selected browser types, manifests, repository binding, saved tool state, hosted URLs and starter files.',
35
+ purpose: 'Existing projects: selected browser types, manifests, repository binding, saved tool state, hosted URLs and starter files.',
36
36
  tools: [
37
37
  'list_my_projects',
38
38
  'get_project_state',
@@ -45,10 +45,11 @@ export const DEVELOPMENT_SERVICES = [
45
45
  'create_ci_ingest_secret',
46
46
  'upsert_hosted_page',
47
47
  'verify_hosted_artifact',
48
+ 'remove_hosted_page',
48
49
  'list_hosted_pages',
49
50
  'get_release_readiness',
50
51
  ],
51
- access: 'Own-project MCP reads are free and require identity. Create projects in the cabinet. Synchronize repository metadata, source/built manifests and scope with typed revisioned patches. project.write, evidence.write and hosted.write require explicit OAuth consent. Repository metadata does not grant GitHub access. CI evidence (source=ci) is written only by the verified ingest endpoint — create its secret with create_ci_ingest_secret. Automated release-readiness access requires a Pro project.',
52
+ access: 'Own-project MCP reads are free and require identity. Projects are created in the cabinet. Repository metadata, source/built manifests and scope synchronize through typed revisioned patches. project.write, evidence.write and hosted.write require explicit OAuth consent. Repository metadata does not grant GitHub access. CI evidence (source=ci) is written only by the verified ingest endpoint, which authenticates with a secret from create_ci_ingest_secret. Automated release-readiness access requires a Pro project.',
52
53
  urls: [
53
54
  DEVELOPMENT_GUIDE_URL,
54
55
  'https://dojo.extenshi.io/projects',
@@ -57,28 +58,28 @@ export const DEVELOPMENT_SERVICES = [
57
58
  },
58
59
  {
59
60
  id: 'manifest',
60
- purpose: 'Choose minimum permissions, target browsers and manifest entries; validate every referenced file.',
61
+ purpose: 'Minimum permissions, target browsers and manifest entries, with every referenced file present.',
61
62
  tools: ['list_extension_templates', 'get_project_state', 'get_project_scaffold'],
62
- access: 'Free template guidance; project reads require identity. The cabinet also has a manifest editor.',
63
+ access: 'Free template reference; project reads require identity. The cabinet also has a manifest editor.',
63
64
  urls: [docs('manifest-generator'), toolPage('manifest-generator')],
64
65
  },
65
66
  {
66
67
  id: 'localization',
67
- purpose: 'Translate extension messages locally with your coding agent and validate the resulting locales.',
68
+ purpose: 'Local translation of extension messages and validation of the resulting locales.',
68
69
  tools: ['localize_workflow'],
69
- access: 'Free static workflow; local CLI validation requires no key or Extenshi credits. Translation uses your agent provider. Check CLI release availability before invoking commands.',
70
+ access: "Free static reference; local CLI validation requires no key or Extenshi credits. Translation uses the developer's own provider. CLI release availability is part of the reference.",
70
71
  urls: [docs('localization')],
71
72
  },
72
73
  {
73
74
  id: 'icons',
74
- purpose: 'Design the SVG, preview at toolbar sizes and export store assets with the local CLI.',
75
+ purpose: 'SVG icon design, toolbar-size preview and store-asset export with the local CLI.',
75
76
  tools: ['generate_icon_workflow'],
76
- access: 'Free workflow. Drawing, browser preview and file export happen in the local agent environment; the cabinet offers its own icon generator subject to availability and credits.',
77
+ access: 'Free. Drawing, browser preview and file export happen locally; the cabinet offers its own icon generator subject to availability and credits.',
77
78
  urls: [docs('icon-generator'), toolPage('icon-generator')],
78
79
  },
79
80
  {
80
81
  id: 'privacy',
81
- purpose: 'Describe actual data practices; generate/export a policy or maintain a hosted policy and its version history.',
82
+ purpose: 'A policy that reflects actual data practices: generated and exported, or hosted with version history.',
82
83
  tools: [
83
84
  'list_privacy_policy_versions',
84
85
  'get_privacy_policy_version',
@@ -90,9 +91,9 @@ export const DEVELOPMENT_SERVICES = [
90
91
  },
91
92
  {
92
93
  id: 'onboarding',
93
- purpose: 'Prepare a welcome page, pin guide, install instructions and uninstall survey; wire verified URLs into the extension.',
94
+ purpose: 'Welcome page, pin guide, install instructions and uninstall survey, with verified URLs wired into the extension.',
94
95
  tools: ['generate_welcome_page_workflow', 'get_project_state'],
95
- access: 'Free welcome-page brief. Edit, host and inspect responses in the cabinet where enabled; account/project limits apply. MCP returns guidance and saved state, not a page-publishing tool.',
96
+ access: 'Free welcome-page specification. Editing, hosting and responses live in the cabinet where enabled; account/project limits apply. MCP returns specifications and saved state; it has no page-publishing tool.',
96
97
  urls: [
97
98
  DEVELOPMENT_GUIDE_URL,
98
99
  docs('pin-guide'),
@@ -105,9 +106,15 @@ export const DEVELOPMENT_SERVICES = [
105
106
  },
106
107
  {
107
108
  id: 'listing-and-marketing',
108
- purpose: 'Prepare listing copy, screenshots, landing page, support links and AI discovery assets.',
109
- tools: [],
110
- access: 'Use CLI generate-listing / review-risk and cabinet tools where enabled. MCP has no listing, landing-page or SEO execution tool.',
109
+ purpose: 'Listing copy, screenshots, landing page, support links and AI discovery assets.',
110
+ tools: [
111
+ 'generate_landing_page',
112
+ 'publish_landing_page',
113
+ 'get_landing_page',
114
+ 'unpublish_landing_page',
115
+ 'upsert_hosted_page',
116
+ ],
117
+ access: 'The landing-page generator is free and offline: it returns static HTML (CLI: extenshi page generate). The same page can be hosted by Extenshi at page.extenshi.io/{code} with publish_landing_page (identity and hosted.write; CLI: extenshi page publish), which also registers it as the project homepage; images there are store screenshots or Dojo uploads. A page hosted elsewhere on HTTPS is registered with upsert_hosted_page (CLI: extenshi page register). The registered homepage feeds HOMEPAGE_URL. Listing copy and store-risk review are covered by CLI generate-listing / review-risk and cabinet tools where enabled. MCP has no listing or SEO execution tool.',
111
118
  urls: [
112
119
  docs('cli'),
113
120
  docs('ai-visibility'),
@@ -119,23 +126,23 @@ export const DEVELOPMENT_SERVICES = [
119
126
  },
120
127
  {
121
128
  id: 'verification-and-ci',
122
- purpose: 'Test the built extension in each target browser, review store risks, scan the final package and retain reports in CI.',
129
+ purpose: 'Testing the built extension in each target browser, store-risk review, final package scan and CI report retention.',
123
130
  tools: ['scan_extension'],
124
- access: 'Scan requires a local artifact and API key, and spends 1 scan credit. CLI review-risk is local. Configure GitHub Actions in the repository; browser tests use the agent environment.',
131
+ access: 'Scan requires a local artifact and API key, and spends 1 scan credit. CLI review-risk is local. GitHub Actions is configured in the repository; browser tests run in the local environment.',
125
132
  urls: [docs('cli'), docs('cli-github-actions'), docs('store-policies')],
126
133
  },
127
134
  {
128
135
  id: 'publishing',
129
- purpose: 'Validate store credentials, submit the exact tested package and verify review status and the public listing.',
136
+ purpose: 'Store credential validation, submission of the exact tested package to Chrome Web Store, Firefox Add-ons and/or Edge Add-ons, and verification of review status and the public listing.',
130
137
  tools: ['publish_extension'],
131
138
  access: 'Local stdio or CLI with local store credentials; publishing access is checked. Store registration, disclosures and review are separate steps. Upload success alone does not establish a live release.',
132
139
  urls: [docs('cli'), docs('publish-to-chrome-web-store'), toolPage('publish')],
133
140
  },
134
141
  {
135
142
  id: 'maintenance',
136
- purpose: 'Claim the listing, respond to findings, inspect reviews/uninstall feedback, update policies and maintain releases.',
143
+ purpose: 'Listing claims, finding responses, reviews and uninstall feedback, policy updates and ongoing releases.',
137
144
  tools: ['get_reviews', 'get_security', 'get_project_state'],
138
- access: 'Catalog reads are metered. Ownership, declarations, responses, badges and feedback management use the cabinet; consult account access.',
145
+ access: 'Catalog reads are metered. Ownership, declarations, responses, badges and feedback management live in the cabinet and depend on account access.',
139
146
  urls: [
140
147
  docs('claim-your-extension'),
141
148
  docs('respond-to-findings'),
@@ -165,63 +172,111 @@ export const DEVELOPMENT_SERVICES = [
165
172
  'set_pay_enabled',
166
173
  'rotate_pay_key',
167
174
  ],
168
- access: 'Pay applications work independently of development projects. Explicit pay.read/pay.write permission is required; older connections and API keys have no Pay grant. Check get_pay_readiness and actual SDK distribution before integrating. Author completes seller agreement and Stripe KYC in the browser. Configure offers and profile, then enable checkout only with explicit authorization. Registration does not prove production deployment or npm publication.',
175
+ access: 'Pay applications work independently of development projects. Explicit pay.read/pay.write permission is required; older connections and API keys have no Pay grant. Readiness (get_pay_readiness) and the actual SDK distribution determine whether integration is possible. The author completes the seller agreement and Stripe KYC in the browser. Checkout is enabled only after offers and profile are configured, and only with explicit authorization. Registration does not prove production deployment or npm publication.',
169
176
  urls: [docs('pay-sdk'), 'https://dojo.extenshi.io/payments'],
170
177
  },
171
178
  ];
179
+ /**
180
+ * The development lifecycle as a process description. `actions` describes what
181
+ * the stage consists of; `relatedTools` is a factual list of the tools that
182
+ * cover it (not an instruction to call them); `doneWhen` is the exit criterion.
183
+ */
172
184
  const WORKFLOW = [
173
185
  {
174
186
  id: 'scope',
175
- actions: 'Record the user problem, target sites and browsers, MVP, permissions/data needs, acceptance criteria, distribution and optional monetization. Inspect available tools with get_development_guide; use search_docs for current details. Keep deferred features out of release promises.',
187
+ actions: 'Stage 1 — Scope: the user problem, target sites and browsers, MVP, permissions/data needs, acceptance criteria, distribution and optional monetization are written down. Deferred features stay out of release promises.',
188
+ relatedTools: ['get_development_guide', 'search_docs'],
176
189
  doneWhen: 'A written scope and acceptance checklist cover implementation, testing, assets, release and maintenance.',
177
190
  },
178
191
  {
179
192
  id: 'research',
180
- actions: 'If market research is needed, check get_credit_balance, then search_extensions / market_overview, get_extension and get_reviews for a small relevant set. Use get_security for detailed findings or get_risk_by_store_ids for a batch. Record gaps and constraints.',
181
- doneWhen: 'The chosen feature and supported surfaces have evidence; optional research is marked skipped with a reason.',
193
+ actions: 'Stage 2 — Research (optional): demand, competitors, user complaints and security findings for a small relevant set of existing extensions; gaps and constraints are recorded. Catalog reads are metered, so the credit balance matters here.',
194
+ relatedTools: [
195
+ 'get_credit_balance',
196
+ 'search_extensions',
197
+ 'market_overview',
198
+ 'get_extension',
199
+ 'get_reviews',
200
+ 'get_security',
201
+ 'get_risk_by_store_ids',
202
+ ],
203
+ doneWhen: 'The chosen feature and supported surfaces have evidence; skipped research is recorded as skipped with a reason.',
182
204
  },
183
205
  {
184
206
  id: 'project-and-repository',
185
- actions: 'With identity, call list_my_projects then get_project_state for the selected project. Reuse its repository. If no project exists, create/configure one in dojo where available; otherwise continue locally and record that integration is pending. Create or reuse a Git remote, preferably GitHub, before substantial implementation.',
207
+ actions: 'Stage 3 — Project and repository: an existing dojo project and its bound repository are reused. Without a project, one is created in dojo where available, or work continues locally with integration recorded as pending. A Git remote (GitHub preferred) exists before substantial implementation.',
208
+ relatedTools: ['list_my_projects', 'get_project_state'],
186
209
  doneWhen: 'Project ID (or explicit pending status), repository URL, branch, README, build commands and release checklist are recorded.',
187
210
  },
188
211
  {
189
212
  id: 'architecture-and-scaffold',
190
- actions: 'Call list_extension_templates, choose minimum permissions and browser-specific files. For a new project call get_project_scaffold once per browser into separate outputs; preserve existing code when integrating an existing repository. Read includeToolStates only for needed keys. Write integration.file verbatim to integration.path, review integration.unwired and re-read state after cabinet changes.',
213
+ actions: 'Stage 4 — Architecture and scaffold: extension types, minimum permissions and browser-specific files are chosen. A new project gets one scaffold per browser in separate outputs; an existing repository keeps its code. Tool states are read only for the keys the extension needs. integration.file is written verbatim to integration.path, integration.unwired lists what is still unconnected, and project state is re-read after cabinet changes.',
214
+ relatedTools: ['list_extension_templates', 'get_project_scaffold', 'get_project_state'],
191
215
  doneWhen: 'Each manifest references real packaged files; browser variants and the project integration contract are preserved.',
192
216
  },
193
217
  {
194
218
  id: 'implementation',
195
- actions: 'Implement the MVP, accessible popup/options, storage and error handling. Test actual target sites and extension lifecycle, including service-worker restart and permission denial. Use localize_workflow for local message translation, structural validation and manual language/RTL review. If payments or user accounts are needed, verify the supported integration and complete its prerequisites before depending on it.',
219
+ actions: 'Stage 5 — Implementation: the MVP, accessible popup/options, storage and error handling, tested on the actual target sites and across the extension lifecycle, including service-worker restart and permission denial. Localization covers message translation, structural validation and manual language/RTL review. Payments or user accounts depend on a verified supported integration with its prerequisites complete.',
220
+ relatedTools: ['localize_workflow'],
196
221
  doneWhen: 'Acceptance criteria pass on real target surfaces; optional integrations have end-to-end evidence or remain explicit blockers.',
197
222
  },
198
223
  {
199
224
  id: 'assets-and-hosted-pages',
200
- actions: "Use generate_icon_workflow and generate_welcome_page_workflow as needed. Prepare screenshots, pin/install instructions, a privacy policy, uninstall feedback, support and landing URLs. For an existing Pro policy, list/read versions, then update_privacy_policy_with_ai when needed, review proposedMarkdown and publish within the author's authorization. Re-read get_project_state and verify the returned URLs.",
225
+ actions: "Stage 6 — Assets and hosted pages: icon, welcome page, screenshots, pin/install instructions, privacy policy, uninstall feedback, support and landing URLs. A landing page is generated as static HTML and either hosted by Extenshi (page.extenshi.io) or on any HTTPS origin; it is registered as the project homepage, which sets HOMEPAGE_URL. An existing Pro policy is updated as a reviewed proposal (proposedMarkdown) and published within the author's authorization. Returned URLs are verified against project state.",
226
+ relatedTools: [
227
+ 'generate_icon_workflow',
228
+ 'generate_welcome_page_workflow',
229
+ 'generate_landing_page',
230
+ 'publish_landing_page',
231
+ 'upsert_hosted_page',
232
+ 'list_privacy_policy_versions',
233
+ 'get_privacy_policy_version',
234
+ 'update_privacy_policy_with_ai',
235
+ 'publish_privacy_policy',
236
+ 'get_project_state',
237
+ ],
201
238
  doneWhen: 'Assets show the real product; hosted links load and match actual data practices; installation/uninstallation flows work.',
202
239
  },
203
240
  {
204
241
  id: 'quality-and-listing',
205
- actions: 'Build each browser package; run unit/integration checks and manual browser scenarios. Get exact review-risk and generate-listing commands from search_docs; review disclosures, permission justifications, listing copy and screenshots against the build. Run scan_extension if available, otherwise the local CLI. Add CI using cli-github-actions docs.',
242
+ actions: 'Stage 7 — Quality and listing: each browser package is built; unit/integration checks and manual browser scenarios run. Disclosures, permission justifications, listing copy and screenshots are reviewed against the build (CLI review-risk and generate-listing; exact commands in the CLI docs). The final package is scanned, and CI follows the cli-github-actions docs.',
243
+ relatedTools: ['search_docs', 'scan_extension'],
206
244
  doneWhen: 'The exact versioned artifact has passing checks, retained scan/review reports and truthful store materials; unresolved findings have a disposition.',
207
245
  },
208
246
  {
209
247
  id: 'release',
210
- actions: "Verify store accounts, credentials and submission access; use publish_extension with validate_only first when available. Submit the tested artifact within the user's publishing authorization through local MCP, CLI or the store console. Record upload, submission, approval and public-listing status separately.",
248
+ actions: "Stage 8 — Release: store accounts, credentials and submission access are verified; a validate-only run precedes submission where available. The tested artifact is submitted within the user's publishing authorization through local MCP, CLI or the store console. Upload, submission, approval and public-listing status are recorded separately.",
249
+ relatedTools: ['publish_extension'],
211
250
  doneWhen: 'Store status and installed version are verified; pending store review is reported as pending, with artifact and source commit recorded.',
212
251
  },
213
252
  {
214
253
  id: 'operate',
215
- actions: 'Claim the catalog listing, maintain declarations and a security badge, review findings and uninstall feedback, verify optional purchase/license flows, and plan updates. Repeat build, review, scan, policy and release checks for later versions.',
254
+ actions: 'Stage 9 — Operate: catalog listing claim, declarations and security badge, findings and uninstall feedback, optional purchase/license flow checks, and planned updates. Later versions repeat the build, review, scan, policy and release checks.',
255
+ relatedTools: ['get_reviews', 'get_security', 'get_project_state'],
216
256
  doneWhen: 'A handoff records repository/commit, artifacts, URLs, checks, remaining blockers, support owner and follow-up work.',
217
257
  },
218
258
  ];
219
- export function buildDevelopmentGuide(registeredTools) {
259
+ /** Top-level sections of the full guide, selectable via the `sections` parameter. */
260
+ export const GUIDE_SECTIONS = [
261
+ 'tools',
262
+ 'localActions',
263
+ 'services',
264
+ 'repository',
265
+ 'workflow',
266
+ 'handoff',
267
+ ];
268
+ const SECTION_SUMMARIES = {
269
+ tools: 'Every tool registered on this connection: description, read-only/destructive hints and docs links.',
270
+ localActions: 'Artifact scan and store publishing: availability on this connection and the local fallback.',
271
+ services: 'Service directory: purpose, related tools, access requirements and URLs per lifecycle area.',
272
+ repository: 'Git repository recommendation, setup, layout and secret-handling practice.',
273
+ workflow: 'The nine lifecycle stages with descriptions, related tools and exit criteria.',
274
+ handoff: 'Items a completed handoff records.',
275
+ };
276
+ const AVAILABILITY = 'Tool lists describe the tools registered on THIS connection. Registration does not prove account access, remaining credits or local prerequisites. Service URLs describe where work happens; account/project access is checked live. Exact input schemas come from MCP tools/list. This guide makes no network calls.';
277
+ function buildSections(registeredTools) {
220
278
  const names = new Set(registeredTools.map((tool) => tool.name));
221
279
  return {
222
- schemaVersion: 1,
223
- documentation: DEVELOPMENT_GUIDE_URL,
224
- availability: 'tools lists the tools registered on THIS connection. Registration does not prove account access, remaining credits or local prerequisites. Service URLs describe where work happens; check live account/project access. Use MCP tools/list for the exact input schemas. This guide makes no network calls.',
225
280
  tools: registeredTools.map((tool) => ({
226
281
  ...tool,
227
282
  docs: [
@@ -231,7 +286,7 @@ export function buildDevelopmentGuide(registeredTools) {
231
286
  localActions: ['scan_extension', 'publish_extension'].map((name) => ({
232
287
  name,
233
288
  availableInThisConnection: names.has(name),
234
- fallback: 'Use local @extenshi/mcp (stdio), or npx @extenshi/cli@latest on the machine holding the artifact. Read search_docs for exact commands and prerequisites.',
289
+ fallback: 'Available through local @extenshi/mcp (stdio), or npx @extenshi/cli@latest on the machine holding the artifact. Exact commands and prerequisites: the CLI documentation.',
235
290
  docs: docs('cli'),
236
291
  })),
237
292
  services: DEVELOPMENT_SERVICES.map(({ tools, ...service }) => ({
@@ -239,18 +294,18 @@ export function buildDevelopmentGuide(registeredTools) {
239
294
  toolsInThisConnection: tools.filter((name) => names.has(name)),
240
295
  })),
241
296
  repository: {
242
- recommendation: 'Keep source in a developer-owned Git repository; prefer GitHub for the existing dojo integration and GitHub Actions. Reuse the bound repository. GitLab, Bitbucket or self-hosted Git also work with local code and CI; their automatic dojo binding is not provided by these MCP tools.',
243
- setup: "Choose repository owner and visibility with the developer; use a private repository unless public source is intended. Connect GitHub at https://dojo.extenshi.io/integrations and select the repository in the project where enabled. Repository creation/writes use GitHub, its connector/CLI or the cabinet, with the user's authorization.",
297
+ recommendation: 'Source lives in a developer-owned Git repository; GitHub fits the existing dojo integration and GitHub Actions. An already-bound repository is reused. GitLab, Bitbucket or self-hosted Git also work with local code and CI; automatic dojo binding for them is not provided by these MCP tools.',
298
+ setup: "Repository owner and visibility are the developer's choice; private unless public source is intended. GitHub connects at https://dojo.extenshi.io/integrations, and the repository is selected in the project where enabled. Repository creation and writes go through GitHub, its connector/CLI or the cabinet, with the user's authorization.",
244
299
  layout: [
245
300
  'README.md: setup, target browsers, build/test/release commands',
246
301
  'src/: extension logic and extenshi.config.js at the path supplied by the project',
247
- 'assets/ and _locales/: icons and translations (follow the chosen framework layout)',
302
+ 'assets/ and _locales/: icons and translations (following the chosen framework layout)',
248
303
  'tests/: behavior and browser scenarios',
249
304
  'docs/: privacy source, listing copy, support and release checklist',
250
305
  '.github/workflows/: build, tests and artifact scan',
251
- 'dist/: generated per-browser packages; attach versioned artifacts to CI/releases',
306
+ 'dist/: generated per-browser packages; versioned artifacts attached to CI/releases',
252
307
  ],
253
- practice: 'Commit source, dependency lockfile and .env.example with placeholders. Keep tokens, store credentials, signing keys, .env and user data in local/CI secret storage. Use branches and reviewable pull requests; associate release artifacts with a source commit/tag.',
308
+ practice: 'Committed: source, dependency lockfile and .env.example with placeholders. Kept in local/CI secret storage: tokens, store credentials, signing keys, .env and user data. Changes go through branches and reviewable pull requests; release artifacts are associated with a source commit/tag.',
254
309
  docs: [
255
310
  'https://docs.github.com/en/repositories/creating-and-managing-repositories/quickstart-for-repositories',
256
311
  docs('cli-github-actions'),
@@ -270,4 +325,37 @@ export function buildDevelopmentGuide(registeredTools) {
270
325
  ],
271
326
  };
272
327
  }
328
+ /** Normalise a caller's `sections` argument: unknown ids are dropped, `all` expands. */
329
+ export function resolveGuideSections(requested) {
330
+ if (!requested || requested.length === 0)
331
+ return [];
332
+ if (requested.includes('all'))
333
+ return [...GUIDE_SECTIONS];
334
+ return GUIDE_SECTIONS.filter((section) => requested.includes(section));
335
+ }
336
+ /**
337
+ * Build the guide. With no `sections`, returns the compact overview: tool names,
338
+ * workflow stage ids with exit criteria, and a table of contents. Listed
339
+ * sections (or `all`) are returned in full.
340
+ */
341
+ export function buildDevelopmentGuide(registeredTools, requested) {
342
+ const sections = resolveGuideSections(requested);
343
+ const full = buildSections(registeredTools);
344
+ const base = { schemaVersion: 2, documentation: DEVELOPMENT_GUIDE_URL, availability: AVAILABILITY };
345
+ if (sections.length > 0) {
346
+ return { ...base, ...Object.fromEntries(sections.map((section) => [section, full[section]])) };
347
+ }
348
+ return {
349
+ ...base,
350
+ overview: 'Extenshi development lifecycle reference: idea and research, project and repository, scaffold, implementation, assets and hosted pages, quality and listing, store release, maintenance.',
351
+ toolNames: registeredTools.map((tool) => tool.name),
352
+ workflowStages: WORKFLOW.map(({ id, doneWhen }) => ({ id, doneWhen })),
353
+ contents: GUIDE_SECTIONS.map((id) => ({
354
+ section: id,
355
+ summary: SECTION_SUMMARIES[id],
356
+ entries: Array.isArray(full[id]) ? full[id].length : undefined,
357
+ })),
358
+ sectionsParameter: 'Full sections are included when named in the `sections` argument (e.g. ["workflow", "services"]); "all" returns every section.',
359
+ };
360
+ }
273
361
  //# sourceMappingURL=development-guide.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"development-guide.js","sourceRoot":"","sources":["../src/development-guide.ts"],"names":[],"mappings":"AAaA,MAAM,IAAI,GAAG,CAAC,IAAY,EAAE,EAAE,CAAC,uCAAuC,IAAI,EAAE,CAAA;AAC5E,MAAM,QAAQ,GAAG,CAAC,GAAW,EAAE,EAAE,CAAC,kCAAkC,GAAG,EAAE,CAAA;AAEzE,MAAM,CAAC,MAAM,qBAAqB,GAAG,IAAI,CAAC,sBAAsB,CAAC,CAAA;AAE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ACtF,CAAC,CAAC;QACH,iBAAiB,EAChB,gIAAgI;KACjI,CAAA;AACF,CAAC"}
package/dist/docs.d.ts CHANGED
@@ -38,12 +38,53 @@ export declare function splitSections(full: string): DocSection[];
38
38
  * the body. Pure (no I/O) so it is unit-testable with a fixture.
39
39
  */
40
40
  export declare function rankSections(full: string, query: string, limit: number): DocSection[];
41
+ /**
42
+ * One searchable passage: a `##` subsection of a docs page (or the page intro
43
+ * before its first `##`). Returning passages instead of whole pages keeps a
44
+ * search result proportional to the question — a page can run to 8k+ chars,
45
+ * while the answer usually lives in one subsection.
46
+ */
47
+ export interface DocPassage {
48
+ page: string;
49
+ heading?: string;
50
+ url?: string;
51
+ body: string;
52
+ }
53
+ /** Split `llms-full.txt` into `##`-level passages, fence-aware, carrying the page source URL. */
54
+ export declare function splitPassages(full: string): DocPassage[];
55
+ /**
56
+ * Rank passages against a query with BM25 over passage bodies, so a long
57
+ * passage that merely repeats common words does not outrank a short one that
58
+ * answers the question. Heading and page-title matches add a bonus; hyphenated
59
+ * or long tokens (command and flag names) get a phrase boost. Pure (no I/O) so
60
+ * it is unit-testable with a fixture.
61
+ */
62
+ export declare function rankPassages(full: string, query: string, limit: number): DocPassage[];
63
+ /** Default and bounds for the per-result excerpt length (characters). */
64
+ export declare const DEFAULT_EXCERPT_CHARS = 1500;
65
+ export declare const MIN_EXCERPT_CHARS = 200;
66
+ export declare const MAX_EXCERPT_CHARS = 8000;
67
+ /**
68
+ * Cut a passage to `maxChars` on a line boundary. An unterminated code fence is
69
+ * closed so the rest of the response still renders as prose.
70
+ */
71
+ export declare function excerpt(body: string, maxChars: number): {
72
+ text: string;
73
+ truncated: boolean;
74
+ };
41
75
  /** Fetch the docs index (`llms.txt`) — the page list returned when no query is given. */
42
76
  export declare function getDocsIndex(docsUrl: string): Promise<string>;
77
+ export interface SearchDocsOptions {
78
+ /** Max passages returned. */
79
+ limit: number;
80
+ /** Max characters per passage excerpt. */
81
+ maxChars?: number;
82
+ }
83
+ /** Render ranked passages: page › heading, source URL, bounded excerpt. Pure. */
84
+ export declare function renderPassages(query: string, matches: DocPassage[], maxChars: number): string;
43
85
  /**
44
- * Search the docs and return a formatted, LLM-friendly answer: the top matching
45
- * sections, each with its source link. Falls back to a clear "nothing matched"
46
- * note pointing at the index.
86
+ * Search the docs and return the top matching passages, each with its source
87
+ * link and a bounded excerpt. Falls back to a "nothing matched" note.
47
88
  */
48
- export declare function searchDocs(docsUrl: string, query: string, limit: number): Promise<string>;
89
+ export declare function searchDocs(docsUrl: string, query: string, options: SearchDocsOptions): Promise<string>;
49
90
  //# sourceMappingURL=docs.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"docs.d.ts","sourceRoot":"","sources":["../src/docs.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,qEAAqE;AACrE,qBAAa,SAAU,SAAQ,KAAK;gBACvB,OAAO,EAAE,MAAM;CAI3B;AAED,4EAA4E;AAC5E,MAAM,WAAW,UAAU;IAC1B,KAAK,EAAE,MAAM,CAAA;IACb,IAAI,EAAE,MAAM,CAAA;CACZ;AAkDD,mEAAmE;AACnE,wBAAgB,cAAc,IAAI,IAAI,CAErC;AAED;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,UAAU,EAAE,CAyBxD;AAoCD;;;GAGG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,UAAU,EAAE,CAwBrF;AAUD,yFAAyF;AACzF,wBAAsB,YAAY,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAEnE;AAED;;;;GAIG;AACH,wBAAsB,UAAU,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAa/F"}
1
+ {"version":3,"file":"docs.d.ts","sourceRoot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