ghost-api-cli 0.2.0__py3-none-any.whl

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 (125) hide show
  1. ghost_api/__init__.py +3 -0
  2. ghost_api/__main__.py +5 -0
  3. ghost_api/adopt.py +173 -0
  4. ghost_api/agent/__init__.py +0 -0
  5. ghost_api/agent/orchestrator.py +413 -0
  6. ghost_api/agent/prompts.py +149 -0
  7. ghost_api/agent/tools.py +84 -0
  8. ghost_api/analysis/__init__.py +0 -0
  9. ghost_api/analysis/analyzer.py +130 -0
  10. ghost_api/analysis/detectors.py +188 -0
  11. ghost_api/analysis/exposure.py +80 -0
  12. ghost_api/analysis/graphql.py +67 -0
  13. ghost_api/analysis/models.py +64 -0
  14. ghost_api/analysis/schema.py +109 -0
  15. ghost_api/analysis/url_grouping.py +217 -0
  16. ghost_api/api.py +264 -0
  17. ghost_api/audit.py +78 -0
  18. ghost_api/browser/__init__.py +0 -0
  19. ghost_api/browser/auth_state.py +172 -0
  20. ghost_api/browser/driver.py +273 -0
  21. ghost_api/browser/egress.py +183 -0
  22. ghost_api/browser/gate.py +127 -0
  23. ghost_api/browser/install.py +28 -0
  24. ghost_api/browser/snapshot.py +221 -0
  25. ghost_api/capture/__init__.py +0 -0
  26. ghost_api/capture/filters.py +255 -0
  27. ghost_api/capture/har.py +148 -0
  28. ghost_api/capture/models.py +41 -0
  29. ghost_api/capture/personal.py +188 -0
  30. ghost_api/capture/recorder.py +181 -0
  31. ghost_api/cli/__init__.py +44 -0
  32. ghost_api/cli/_common.py +219 -0
  33. ghost_api/cli/client.py +487 -0
  34. ghost_api/cli/data.py +492 -0
  35. ghost_api/cli/explore.py +379 -0
  36. ghost_api/cli/manage.py +437 -0
  37. ghost_api/config.py +132 -0
  38. ghost_api/drift.py +344 -0
  39. ghost_api/drive.py +211 -0
  40. ghost_api/errors.py +106 -0
  41. ghost_api/events.py +213 -0
  42. ghost_api/exitcodes.py +21 -0
  43. ghost_api/export/__init__.py +71 -0
  44. ghost_api/export/confidence.py +45 -0
  45. ghost_api/export/html.py +41 -0
  46. ghost_api/export/openapi.py +201 -0
  47. ghost_api/export/report.py +227 -0
  48. ghost_api/export/site_data.py +196 -0
  49. ghost_api/export/tabular.py +88 -0
  50. ghost_api/export/viewer/report.html +286 -0
  51. ghost_api/generator/__init__.py +221 -0
  52. ghost_api/generator/cassettes.py +80 -0
  53. ghost_api/generator/models_gen.py +144 -0
  54. ghost_api/generator/naming.py +174 -0
  55. ghost_api/generator/package.py +197 -0
  56. ghost_api/generator/python_gen.py +172 -0
  57. ghost_api/generator/spec.py +486 -0
  58. ghost_api/generator/templates/client.py.j2 +518 -0
  59. ghost_api/generator/templates/client.test.ts.j2 +106 -0
  60. ghost_api/generator/templates/client.ts.j2 +339 -0
  61. ghost_api/generator/templates/models.py.j2 +45 -0
  62. ghost_api/generator/templates/package_readme.md.j2 +111 -0
  63. ghost_api/generator/templates/pyproject.toml.j2 +22 -0
  64. ghost_api/generator/templates/test_client.py.j2 +105 -0
  65. ghost_api/generator/ts_gen.py +232 -0
  66. ghost_api/integrations/__init__.py +0 -0
  67. ghost_api/integrations/claude_code/commands/ghost-data.md +10 -0
  68. ghost_api/integrations/claude_code/commands/ghost-diff.md +10 -0
  69. ghost_api/integrations/claude_code/commands/ghost-explore.md +10 -0
  70. ghost_api/integrations/claude_code/skills/ghost-api/SKILL.md +46 -0
  71. ghost_api/integrations/setup.py +84 -0
  72. ghost_api/llm/__init__.py +0 -0
  73. ghost_api/llm/doctor.py +60 -0
  74. ghost_api/llm/gateway.py +476 -0
  75. ghost_api/llm/providers.py +124 -0
  76. ghost_api/memory/__init__.py +0 -0
  77. ghost_api/memory/knowledge.py +157 -0
  78. ghost_api/memory/store.py +883 -0
  79. ghost_api/net.py +235 -0
  80. ghost_api/netguard.py +203 -0
  81. ghost_api/pipeline.py +745 -0
  82. ghost_api/probe/__init__.py +0 -0
  83. ghost_api/probe/prober.py +311 -0
  84. ghost_api/probe/replay.py +313 -0
  85. ghost_api/project.py +186 -0
  86. ghost_api/py.typed +0 -0
  87. ghost_api/runtime.py +397 -0
  88. ghost_api/serve/__init__.py +101 -0
  89. ghost_api/serve/explorer_mcp.py +305 -0
  90. ghost_api/serve/mcp.py +121 -0
  91. ghost_api/serve/mock.py +130 -0
  92. ghost_api/serve/rest.py +132 -0
  93. ghost_api/site.py +84 -0
  94. ghost_api/specdiff.py +122 -0
  95. ghost_api/ui/__init__.py +0 -0
  96. ghost_api/ui/keys.py +134 -0
  97. ghost_api/ui/repl.py +453 -0
  98. ghost_api/ui/terminal.py +573 -0
  99. ghost_api/verify/__init__.py +0 -0
  100. ghost_api/verify/classify.py +84 -0
  101. ghost_api/verify/repair.py +40 -0
  102. ghost_api/verify/runner.py +110 -0
  103. ghost_api/verify/verifier.py +291 -0
  104. ghost_api/watch.py +313 -0
  105. ghost_api/web/__init__.py +1 -0
  106. ghost_api/web/server.py +690 -0
  107. ghost_api/web/static/assets/Endpoints-zPnjlcM8.js +46 -0
  108. ghost_api/web/static/assets/Run-D85zWHey.js +91 -0
  109. ghost_api/web/static/assets/Settings-D0aWHFAt.js +11 -0
  110. ghost_api/web/static/assets/Site-a88shEmP.js +71 -0
  111. ghost_api/web/static/assets/Watches-CqZWIa9G.js +16 -0
  112. ghost_api/web/static/assets/circle-x-BcTE_1tr.js +11 -0
  113. ghost_api/web/static/assets/index-Ds2e5B9f.js +141 -0
  114. ghost_api/web/static/assets/index-xQpyIBbG.css +1 -0
  115. ghost_api/web/static/assets/minus-C2xqP1eQ.js +6 -0
  116. ghost_api/web/static/assets/refresh-cw-CxdR_8Oi.js +6 -0
  117. ghost_api/web/static/favicon.svg +1 -0
  118. ghost_api/web/static/index.html +26 -0
  119. ghost_api/workflows.py +203 -0
  120. ghost_api_cli-0.2.0.dist-info/METADATA +1019 -0
  121. ghost_api_cli-0.2.0.dist-info/RECORD +125 -0
  122. ghost_api_cli-0.2.0.dist-info/WHEEL +5 -0
  123. ghost_api_cli-0.2.0.dist-info/entry_points.txt +2 -0
  124. ghost_api_cli-0.2.0.dist-info/licenses/LICENSE +21 -0
  125. ghost_api_cli-0.2.0.dist-info/top_level.txt +1 -0
@@ -0,0 +1,16 @@
1
+ import{c as m,j as e,b as y,t as f,o as w,g as C,f as g,C as h,E as $,k as M,S as _,d as P,e as j,a as x,L as R,P as o,B as N}from"./index-Ds2e5B9f.js";import{M as S}from"./minus-C2xqP1eQ.js";import{R as v}from"./refresh-cw-CxdR_8Oi.js";/**
2
+ * @license lucide-react v0.468.0 - ISC
3
+ *
4
+ * This source code is licensed under the ISC license.
5
+ * See the LICENSE file in the root directory of this source tree.
6
+ */const W=m("BellRing",[["path",{d:"M10.268 21a2 2 0 0 0 3.464 0",key:"vwvbt9"}],["path",{d:"M22 8c0-2.3-.8-4.3-2-6",key:"5bb3ad"}],["path",{d:"M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326",key:"11g9vi"}],["path",{d:"M4 2C2.8 3.7 2 5.7 2 8",key:"tap9e0"}]]);/**
7
+ * @license lucide-react v0.468.0 - ISC
8
+ *
9
+ * This source code is licensed under the ISC license.
10
+ * See the LICENSE file in the root directory of this source tree.
11
+ */const q=m("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);/**
12
+ * @license lucide-react v0.468.0 - ISC
13
+ *
14
+ * This source code is licensed under the ISC license.
15
+ * See the LICENSE file in the root directory of this source tree.
16
+ */const z=m("Trash2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]]),B={new:{icon:q,className:"text-ok",label:"New"},changed:{icon:v,className:"text-info",label:"Changed"},gone:{icon:S,className:"text-bad",label:"Gone"}},k=s=>s==null||s===""?"n/a":String(s);function b({change:s}){const{icon:l,className:a,label:n}=B[s.kind];return e.jsxs("li",{className:"flex gap-3 py-2",children:[e.jsx(l,{className:y("mt-0.5 size-4 shrink-0",a),"aria-label":n}),e.jsxs("div",{className:"min-w-0 flex-1 text-sm",children:[e.jsx("span",{className:"font-medium break-words",children:s.title}),s.kind==="changed"&&e.jsx("ul",{className:"mt-0.5 space-y-0.5 text-xs text-muted",children:Object.entries(s.fields).map(([t,[c,r]])=>e.jsxs("li",{className:"break-words",children:[e.jsx("span",{className:"font-mono",children:t}),": ",k(c)," →"," ",e.jsx("span",{className:"text-fg",children:k(r)})]},t))})]}),s.at&&e.jsx("span",{className:"shrink-0 text-xs text-muted",children:f(s.at)})]})}function E({watch:s,changes:l}){var u;const a=P(),n=()=>void a.invalidateQueries({queryKey:["watches"]}),t=j({mutationFn:()=>x.checkWatch(s.id),onSuccess:n}),c=j({mutationFn:()=>x.removeWatch(s.id),onSuccess:n}),r=(u=s.last_status)==null?void 0:u.startsWith("error"),p=Object.entries(s.params);return e.jsxs(h,{className:"p-4",children:[e.jsxs("div",{className:"flex flex-wrap items-start gap-3",children:[e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsxs("span",{className:"text-xs text-muted",children:["#",s.id]}),e.jsx(R,{to:`/sites/${s.site_id}`,className:"font-semibold hover:text-accent",children:s.site}),e.jsx("span",{className:"font-mono text-sm text-accent",children:s.operation})]}),p.length>0&&e.jsx("p",{className:"mt-1 font-mono text-xs break-all text-muted",children:p.map(([i,d])=>`${i}=${d}`).join(" ")}),e.jsxs("div",{className:"mt-2 flex flex-wrap gap-1.5",children:[e.jsxs(o,{children:["every ",s.every]}),s.notify.map(i=>e.jsxs(o,{className:"bg-accent-soft text-accent",children:[e.jsx(W,{className:"size-3"})," ",i.split(":")[0]]},i)),e.jsxs(o,{className:r?"bg-bad/15 text-bad":void 0,children:[s.last_check_at?`checked ${f(s.last_check_at)}`:"not checked yet",s.last_status?` · ${s.last_status}`:""]})]})]}),e.jsxs("div",{className:"flex gap-1.5",children:[e.jsxs(N,{onClick:()=>t.mutate(),disabled:t.isPending,children:[e.jsx(v,{className:y("size-4",t.isPending&&"animate-spin")}),t.isPending?"Checking…":"Check now"]}),e.jsx(N,{variant:"ghost",onClick:()=>c.mutate(),"aria-label":`Remove watch ${s.id}`,children:e.jsx(z,{className:"size-4"})})]})]}),t.data&&e.jsx("p",{className:"mt-2 text-sm text-muted","aria-live":"polite",children:t.data.headline}),(t.error||c.error)&&e.jsx(g,{error:t.error??c.error}),l.length>0&&e.jsx("ul",{className:"mt-3 divide-y divide-line border-t border-line",children:l.slice(0,6).map((i,d)=>e.jsx(b,{change:i},`${i.key}-${i.at}-${d}`))})]})}function F(){var l;const s=w({queryKey:["watches"],queryFn:x.watches,refetchInterval:3e4});return e.jsxs("div",{className:"mx-auto max-w-4xl space-y-5",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl font-bold",children:"Watches"}),e.jsxs("p",{className:"mt-1 text-sm text-muted",children:["Ghost API re-checks these on a schedule and tells you what's new, what changed (a price, a name...) and what disappeared. Checks run while this dashboard is open, or in the background after ",e.jsx("code",{className:"font-mono",children:"ghost-api watch schedule"}),"."]})]}),s.isPending&&e.jsx(C,{className:"h-40"}),s.error&&e.jsx(g,{error:s.error}),s.data&&s.data.watches.length===0&&e.jsx(h,{children:e.jsx($,{icon:e.jsx(M,{className:"size-8"}),title:"No watches yet",children:'Open a site, pick an endpoint, and press "Watch this" under "Use this endpoint".'})}),(l=s.data)==null?void 0:l.watches.map(a=>e.jsx(E,{watch:a,changes:s.data.changes.filter(n=>n.watch_id===a.id)},a.id)),s.data&&s.data.changes.length>0&&e.jsxs(h,{children:[e.jsx(_,{children:"Recent changes, all watches"}),e.jsx("ul",{className:"divide-y divide-line px-4",children:s.data.changes.slice(0,30).map((a,n)=>e.jsx(b,{change:a},`${a.watch_id}-${a.key}-${a.at}-${n}`))})]})]})}export{b as ChangeLine,F as Watches};
@@ -0,0 +1,11 @@
1
+ import{c}from"./index-Ds2e5B9f.js";/**
2
+ * @license lucide-react v0.468.0 - ISC
3
+ *
4
+ * This source code is licensed under the ISC license.
5
+ * See the LICENSE file in the root directory of this source tree.
6
+ */const r=c("CircleCheck",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);/**
7
+ * @license lucide-react v0.468.0 - ISC
8
+ *
9
+ * This source code is licensed under the ISC license.
10
+ * See the LICENSE file in the root directory of this source tree.
11
+ */const a=c("CircleX",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]]);export{a as C,r as a};