gtmmaxing 0.1.3 → 0.1.4

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 (2) hide show
  1. package/dist/gtm.js +100 -4
  2. package/package.json +10 -11
package/dist/gtm.js CHANGED
@@ -18886,7 +18886,10 @@ var TOOL_CATALOG = {
18886
18886
  "linkedin-profile": { name: "LinkedIn profile", credits: 1, unit: "profile", limit: 1 },
18887
18887
  "linkedin-activity": { name: "LinkedIn activity", credits: 1, unit: "profile with posts", limit: 1 },
18888
18888
  "profile-finder": { name: "Find LinkedIn profile", credits: 1, unit: "profile found", limit: 1 },
18889
- "page-content": { name: "Web page content", credits: 1, unit: "page", limit: 1 }
18889
+ "page-content": { name: "Web page content", credits: 1, unit: "page", limit: 1 },
18890
+ "instagram-profile": { name: "Instagram profile", credits: 1, unit: "profile", limit: 1 },
18891
+ "x-search": { name: "X post search", credits: 1, unit: "search (up to 20 posts)", limit: 20 },
18892
+ "reddit-search": { name: "Reddit post search", credits: 1, unit: "search (up to 20 posts)", limit: 20 }
18890
18893
  };
18891
18894
  var toolIdSchema = external_exports.enum(Object.keys(TOOL_CATALOG));
18892
18895
  function publicWebsite(value) {
@@ -18898,6 +18901,13 @@ function publicWebsite(value) {
18898
18901
  return false;
18899
18902
  }
18900
18903
  }
18904
+ var INSTAGRAM_HANDLE = /^[A-Za-z0-9._]{1,30}$/;
18905
+ function instagramHandle(value) {
18906
+ const trimmed = value.trim().replace(/^@/, "");
18907
+ const match = /^(?:https?:\/\/)?(?:www\.)?instagram\.com\/([A-Za-z0-9._]{1,30})\/?(?:[?#].*)?$/i.exec(trimmed);
18908
+ return (match ? match[1] : trimmed).toLowerCase();
18909
+ }
18910
+ var SEARCH_WINDOWS = ["day", "week", "month", "year"];
18901
18911
  var websiteUrl = (value) => /^https:\/\//i.test(value.trim()) ? value.trim() : `https://${value.trim().replace(/^http:\/\//i, "")}`;
18902
18912
  var toolRequestSchema = external_exports.object({
18903
18913
  tool: toolIdSchema,
@@ -18910,6 +18920,8 @@ var toolRequestSchema = external_exports.object({
18910
18920
  titles: external_exports.string().trim().max(200).default(""),
18911
18921
  /** LinkedIn activity: comma-separated topics to look for in posts. Optional so older saved requests keep their hash. */
18912
18922
  keywords: external_exports.string().trim().max(300).optional(),
18923
+ /** X and Reddit search: how far back to look. Optional so older saved requests keep their hash. */
18924
+ within: external_exports.enum(SEARCH_WINDOWS).optional(),
18913
18925
  limit: external_exports.number().int().min(1).max(20).default(10)
18914
18926
  }).strict().superRefine((v, c) => {
18915
18927
  const reject = (message) => c.addIssue({ code: "custom", path: ["query"], message });
@@ -18919,6 +18931,8 @@ var toolRequestSchema = external_exports.object({
18919
18931
  if (v.tool === "local-leads" && !v.location) reject("Add a city or region.");
18920
18932
  if (v.tool === "profile-finder" && !v.company) c.addIssue({ code: "custom", path: ["company"], message: "Add the person's company." });
18921
18933
  if (v.tool === "verify-email" && !external_exports.string().email().safeParse(v.query).success) reject("Enter an email address.");
18934
+ if (v.tool === "instagram-profile" && !INSTAGRAM_HANDLE.test(v.query)) reject("Enter an Instagram username, like gymshark.");
18935
+ if (v.within && !["x-search", "reddit-search"].includes(v.tool)) c.addIssue({ code: "custom", path: ["within"], message: "Only post searches take a time window." });
18922
18936
  if (["phone-pilot", "linkedin-profile", "linkedin-activity"].includes(v.tool) && !/^https:\/\/(www\.)?linkedin\.com\/in\/[a-zA-Z0-9%_-]+\/?$/.test(v.query)) reject("Enter a LinkedIn profile URL.");
18923
18937
  });
18924
18938
  var toolResultSchema = external_exports.object({
@@ -19141,6 +19155,42 @@ var CAPABILITIES = {
19141
19155
  price: toolPrice("page-content"),
19142
19156
  example: { url: "vercel.com/pricing" },
19143
19157
  toolRequest: (input2) => ({ tool: "page-content", query: input2.url })
19158
+ }),
19159
+ "instagram-profile": capability({
19160
+ title: "Instagram profile",
19161
+ description: "Public Instagram profile with followers, bio, website and the business email or phone it shows.",
19162
+ input: external_exports.object({ profile: text(200).describe("Instagram username, @handle or profile URL") }).strict(),
19163
+ row: external_exports.object({ handle: s, name: s, bio: s, followers: n, following: n, business: external_exports.boolean(), verified: external_exports.boolean(), website: s, email: s, phone: s, url: s }),
19164
+ preview: ["handle", "followers", "email", "website"],
19165
+ noun: "profiles",
19166
+ price: toolPrice("instagram-profile", "Private and missing accounts are free."),
19167
+ searchWords: "insta ig creator creators influencer influencers brand social contact email phone followers",
19168
+ example: { profile: "gymshark" },
19169
+ toolRequest: (input2) => ({ tool: "instagram-profile", query: instagramHandle(input2.profile) })
19170
+ }),
19171
+ "x-search": capability({
19172
+ title: "X post search",
19173
+ description: "Recent public X (Twitter) posts matching a phrase, newest first, with author and engagement. Every bare word must appear; quote a phrase or use OR.",
19174
+ input: external_exports.object({ query: text(300).describe('Phrase or X search syntax, like "looking for a CRM"'), within: external_exports.enum(SEARCH_WINDOWS).optional(), limit: limit("x-search") }).strict(),
19175
+ row: external_exports.object({ author: s, name: s, followers: n, text: s, postedAt: s, likes: n, replies: n, reposts: n, views: n, reply: external_exports.boolean(), url: s }),
19176
+ preview: ["author", "text", "postedAt"],
19177
+ noun: "posts",
19178
+ price: toolPrice("x-search"),
19179
+ searchWords: "twitter tweets tweet social listening intent buyer buyers asking recommendation mentions",
19180
+ example: { query: '"looking for a CRM"', within: "week" },
19181
+ toolRequest: (input2) => ({ tool: "x-search", query: input2.query, ...input2.within ? { within: input2.within } : {}, ...input2.limit ? { limit: input2.limit } : {} })
19182
+ }),
19183
+ "reddit-search": capability({
19184
+ title: "Reddit post search",
19185
+ description: "Public Reddit posts most relevant to a query, from the past year unless a window is given, with subreddit, score and comments.",
19186
+ input: external_exports.object({ query: text(300), within: external_exports.enum(SEARCH_WINDOWS).optional(), limit: limit("reddit-search") }).strict(),
19187
+ row: external_exports.object({ subreddit: s, title: s, text: s, author: s, postedAt: s, score: n, comments: n, url: s }),
19188
+ preview: ["subreddit", "title", "comments"],
19189
+ noun: "posts",
19190
+ price: toolPrice("reddit-search"),
19191
+ searchWords: "subreddit subreddits threads social listening intent buyer buyers asking recommendation alternatives",
19192
+ example: { query: "best cold email tool", within: "month" },
19193
+ toolRequest: (input2) => ({ tool: "reddit-search", query: input2.query, ...input2.within ? { within: input2.within } : {}, ...input2.limit ? { limit: input2.limit } : {} })
19144
19194
  })
19145
19195
  };
19146
19196
  var CAPABILITY_IDS = Object.keys(CAPABILITIES);
@@ -19587,6 +19637,7 @@ var SPECS = {
19587
19637
  login: { "no-browser": { type: "boolean" } },
19588
19638
  logout: {},
19589
19639
  whoami: {},
19640
+ "auth-header": {},
19590
19641
  contacts: { file: { type: "string" }, column: { type: "string" }, out: { type: "string" }, "run-id": { type: "string" }, find: { type: "string", multiple: true }, verify: { type: "boolean" }, ...PAID },
19591
19642
  list: { titles: { type: "string", multiple: true }, company: { type: "string" }, location: { type: "string" }, "business-type": { type: "string" }, limit: { type: "string" }, ...PAID },
19592
19643
  research: { ...PAID },
@@ -19660,6 +19711,9 @@ function build2(name, values, positionals) {
19660
19711
  case "whoami":
19661
19712
  none("gtm whoami takes no arguments.");
19662
19713
  return { kind: "whoami" };
19714
+ case "auth-header":
19715
+ none("gtm auth-header takes no arguments.");
19716
+ return { kind: "auth-header" };
19663
19717
  case "contacts": {
19664
19718
  const file2 = str(values, "file");
19665
19719
  const runId = str(values, "run-id");
@@ -20374,7 +20428,7 @@ async function toolFile(session, command) {
20374
20428
  import { randomUUID } from "node:crypto";
20375
20429
 
20376
20430
  // src/version.ts
20377
- var VERSION = "0.1.3";
20431
+ var VERSION = "0.1.4";
20378
20432
 
20379
20433
  // src/gateway.ts
20380
20434
  var CliError = class extends Error {
@@ -20562,6 +20616,17 @@ var TOPICS = {
20562
20616
  },
20563
20617
  logout: { summary: "Delete the saved sign-in", lines: ["Usage: gtm logout", "", "Deletes the saved token. Revoke the agent on your GTMMAXING account page to end its access everywhere."] },
20564
20618
  whoami: { summary: "Show the server, balance and this agent's credit cap", lines: ["Usage: gtm whoami"] },
20619
+ "auth-header": {
20620
+ summary: "Print this login as an MCP Authorization header",
20621
+ lines: [
20622
+ "Usage: gtm auth-header",
20623
+ "",
20624
+ `Prints {"Authorization":"Bearer <token>"} for an MCP client's header helper, so the GTMMAXING MCP connection`,
20625
+ "reuses this CLI login (same agent, same credit cap) instead of a second sign-in. For Claude Code:",
20626
+ ` claude mcp add-json --scope user gtmmaxing '{"type":"http","url":"https://gtmmaxing.com/mcp","headersHelper":"gtm auth-header"}'`,
20627
+ "When run as a helper, the token is printed only for a GTMMAXING server. Exits 1 when signed out."
20628
+ ]
20629
+ },
20565
20630
  contacts: {
20566
20631
  summary: "Work emails or mobiles for LinkedIn profiles, a CSV, or a list run",
20567
20632
  lines: [
@@ -20676,7 +20741,7 @@ var TOPICS = {
20676
20741
  ]
20677
20742
  }
20678
20743
  };
20679
- var ORDER = ["login", "logout", "whoami", ...Object.values(TOOL_COMMANDS)];
20744
+ var ORDER = ["login", "logout", "whoami", "auth-header", ...Object.values(TOOL_COMMANDS)];
20680
20745
  function helpText(topic) {
20681
20746
  const entry = topic ? TOPICS[topic] : void 0;
20682
20747
  if (entry) return `gtm ${topic}: ${entry.summary}
@@ -20689,7 +20754,7 @@ ${[...entry.lines, "", "Common options:", ...COMMON].join("\n")}
20689
20754
  "Usage: gtm <command> [options]",
20690
20755
  "",
20691
20756
  "Commands:",
20692
- ...ORDER.map((name) => ` ${name.padEnd(10)}${TOPICS[name].summary}`),
20757
+ ...ORDER.map((name) => ` ${name.padEnd(12)}${TOPICS[name].summary}`),
20693
20758
  "",
20694
20759
  "Start with gtm login. Paid commands need --max-credits N; add --dry-run to see the quote first.",
20695
20760
  "Answers are TOON text: a one-sentence summary, cost, balance, up to 5 rows and the next command. Add --json for JSON.",
@@ -20770,6 +20835,35 @@ async function logout(session) {
20770
20835
  function failed(reason, summary) {
20771
20836
  return shapeAnswer({ status: "error", reason, summary, next: LOGIN_NEXT });
20772
20837
  }
20838
+ async function authHeader(session) {
20839
+ const { io, token, apiUrl } = session;
20840
+ if (!token) {
20841
+ io.stderr("Not signed in; run gtm login.\n");
20842
+ return 1;
20843
+ }
20844
+ const target = io.env.CLAUDE_CODE_MCP_SERVER_URL;
20845
+ if (target && !sameService(target, apiUrl)) {
20846
+ io.stderr(`Refusing to send this login to ${target}; it belongs to ${apiUrl}.
20847
+ `);
20848
+ return 1;
20849
+ }
20850
+ io.stdout(`${JSON.stringify({ Authorization: `Bearer ${token}` })}
20851
+ `);
20852
+ return 0;
20853
+ }
20854
+ function sameService(target, apiUrl) {
20855
+ let url2;
20856
+ let api;
20857
+ try {
20858
+ url2 = new URL(target);
20859
+ api = new URL(apiUrl);
20860
+ } catch {
20861
+ return false;
20862
+ }
20863
+ if (url2.protocol !== api.protocol) return false;
20864
+ const site = api.hostname.replace(/^api\./, "");
20865
+ return url2.host === api.host || url2.hostname === site && url2.port === api.port;
20866
+ }
20773
20867
 
20774
20868
  // src/credentials.ts
20775
20869
  import { chmod, mkdir, readFile, rename, rm, writeFile } from "node:fs/promises";
@@ -20966,6 +21060,8 @@ async function dispatch(session, command) {
20966
21060
  return logout(session);
20967
21061
  case "whoami":
20968
21062
  return whoami(session);
21063
+ case "auth-header":
21064
+ return authHeader(session);
20969
21065
  case "contacts":
20970
21066
  return contacts(session, command);
20971
21067
  case "tool-file":
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gtmmaxing",
3
- "version": "0.1.3",
3
+ "version": "0.1.4",
4
4
  "description": "gtm: the GTMMAXING command line. Find contacts, build lead lists and research companies from a terminal or a coding agent, with credit caps on every paid call.",
5
5
  "keywords": [
6
6
  "gtm",
@@ -24,21 +24,20 @@
24
24
  "engines": {
25
25
  "node": ">=20"
26
26
  },
27
- "scripts": {
28
- "build": "node scripts/build.mjs",
29
- "prepublishOnly": "pnpm build",
30
- "typecheck": "tsc --noEmit",
31
- "lint": "eslint src test",
32
- "test": "vitest run"
33
- },
34
27
  "devDependencies": {
35
- "@found/contracts": "workspace:*",
36
28
  "@types/node": "^24.0.0",
37
29
  "@typescript-eslint/eslint-plugin": "^8.46.4",
38
30
  "@typescript-eslint/parser": "^8.46.4",
39
31
  "esbuild": "0.28.1",
40
32
  "eslint": "^9.39.2",
41
33
  "typescript": "^5.9.3",
42
- "vitest": "^4.1.11"
34
+ "vitest": "^4.1.11",
35
+ "@found/contracts": "0.1.0"
36
+ },
37
+ "scripts": {
38
+ "build": "node scripts/build.mjs",
39
+ "typecheck": "tsc --noEmit",
40
+ "lint": "eslint src test",
41
+ "test": "vitest run"
43
42
  }
44
- }
43
+ }