vibesuite 1.0.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 (117) hide show
  1. package/.agent/skills/agent-recovery/SKILL.md +147 -0
  2. package/.agent/skills/code-review/SKILL.md +81 -0
  3. package/.agent/skills/component-analysis/SKILL.md +103 -0
  4. package/.agent/skills/git-worktree/SKILL.md +78 -0
  5. package/.agent/skills/github-ops/SKILL.md +220 -0
  6. package/.agent/skills/github-ops/scripts/publish_issues.ps1 +443 -0
  7. package/.agent/skills/github-ops/scripts/smart-ops.ps1 +128 -0
  8. package/.agent/skills/github-ops/scripts/smart-ops.sh +130 -0
  9. package/.agent/skills/google-trends/SKILL.md +157 -0
  10. package/.agent/skills/google-trends/scripts/node_modules/.modules.yaml +21 -0
  11. package/.agent/skills/google-trends/scripts/node_modules/.pnpm/commander@12.1.0/node_modules/commander/LICENSE +22 -0
  12. package/.agent/skills/google-trends/scripts/node_modules/.pnpm/commander@12.1.0/node_modules/commander/Readme.md +1157 -0
  13. package/.agent/skills/google-trends/scripts/node_modules/.pnpm/commander@12.1.0/node_modules/commander/esm.mjs +16 -0
  14. package/.agent/skills/google-trends/scripts/node_modules/.pnpm/commander@12.1.0/node_modules/commander/index.js +24 -0
  15. package/.agent/skills/google-trends/scripts/node_modules/.pnpm/commander@12.1.0/node_modules/commander/lib/argument.js +149 -0
  16. package/.agent/skills/google-trends/scripts/node_modules/.pnpm/commander@12.1.0/node_modules/commander/lib/command.js +2509 -0
  17. package/.agent/skills/google-trends/scripts/node_modules/.pnpm/commander@12.1.0/node_modules/commander/lib/error.js +39 -0
  18. package/.agent/skills/google-trends/scripts/node_modules/.pnpm/commander@12.1.0/node_modules/commander/lib/help.js +520 -0
  19. package/.agent/skills/google-trends/scripts/node_modules/.pnpm/commander@12.1.0/node_modules/commander/lib/option.js +330 -0
  20. package/.agent/skills/google-trends/scripts/node_modules/.pnpm/commander@12.1.0/node_modules/commander/lib/suggestSimilar.js +101 -0
  21. package/.agent/skills/google-trends/scripts/node_modules/.pnpm/commander@12.1.0/node_modules/commander/package-support.json +16 -0
  22. package/.agent/skills/google-trends/scripts/node_modules/.pnpm/commander@12.1.0/node_modules/commander/package.json +84 -0
  23. package/.agent/skills/google-trends/scripts/node_modules/.pnpm/commander@12.1.0/node_modules/commander/typings/esm.d.mts +3 -0
  24. package/.agent/skills/google-trends/scripts/node_modules/.pnpm/commander@12.1.0/node_modules/commander/typings/index.d.ts +969 -0
  25. package/.agent/skills/google-trends/scripts/node_modules/.pnpm/google-trends-api@4.9.2/node_modules/google-trends-api/CHANGES.md +132 -0
  26. package/.agent/skills/google-trends/scripts/node_modules/.pnpm/google-trends-api@4.9.2/node_modules/google-trends-api/LICENSE +21 -0
  27. package/.agent/skills/google-trends/scripts/node_modules/.pnpm/google-trends-api@4.9.2/node_modules/google-trends-api/README.md +561 -0
  28. package/.agent/skills/google-trends/scripts/node_modules/.pnpm/google-trends-api@4.9.2/node_modules/google-trends-api/lib/google-trends-api.min.js +2 -0
  29. package/.agent/skills/google-trends/scripts/node_modules/.pnpm/google-trends-api@4.9.2/node_modules/google-trends-api/package.json +68 -0
  30. package/.agent/skills/google-trends/scripts/node_modules/.pnpm/google-trends-api@4.9.2/node_modules/google-trends-api/src/api.js +18 -0
  31. package/.agent/skills/google-trends/scripts/node_modules/.pnpm/google-trends-api@4.9.2/node_modules/google-trends-api/src/index.js +27 -0
  32. package/.agent/skills/google-trends/scripts/node_modules/.pnpm/google-trends-api@4.9.2/node_modules/google-trends-api/src/request.js +69 -0
  33. package/.agent/skills/google-trends/scripts/node_modules/.pnpm/google-trends-api@4.9.2/node_modules/google-trends-api/src/utilities.js +395 -0
  34. package/.agent/skills/google-trends/scripts/node_modules/.pnpm/lock.yaml +31 -0
  35. package/.agent/skills/google-trends/scripts/node_modules/.pnpm-workspace-state-v1.json +25 -0
  36. package/.agent/skills/google-trends/scripts/package.json +17 -0
  37. package/.agent/skills/google-trends/scripts/pnpm-lock.yaml +31 -0
  38. package/.agent/skills/google-trends/scripts/search.js +168 -0
  39. package/.agent/skills/high-fidelity-extraction/SKILL.md +59 -0
  40. package/.agent/skills/prime-agent/SKILL.md +97 -0
  41. package/.agent/skills/security-audit/SKILL.md +81 -0
  42. package/.agent/skills/seo-ready/SKILL.md +133 -0
  43. package/.agent/skills/spawn-task/SKILL.md +130 -0
  44. package/.agent/skills/sync-docs/SKILL.md +88 -0
  45. package/.agent/skills/vercel-ai-sdk/SKILL.md +34083 -0
  46. package/.agent/skills/youtube-pipeline/SKILL.md +194 -0
  47. package/.agent/skills/youtube-pipeline/resources/youtube-phase1-strategy.md +224 -0
  48. package/.agent/skills/youtube-pipeline/resources/youtube-phase2-packaging.md +148 -0
  49. package/.agent/skills/youtube-pipeline/resources/youtube-phase3-scripting.md +197 -0
  50. package/.agent/skills/youtube-pipeline/resources/youtube-phase3.5-shorts.md +271 -0
  51. package/.agent/skills/youtube-pipeline/resources/youtube-phase4-production.md +193 -0
  52. package/.agent/skills/youtube-pipeline/resources/youtube-phase5-repurposing.md +159 -0
  53. package/.agent/skills/youtube-pipeline/resources/youtube-pipeline.md +161 -0
  54. package/.agent/skills/youtube-pipeline/scripts/parse_yt_studio.ps1 +150 -0
  55. package/.agent/workflows/LEGACY/ANTIGRAVITY_TOOLBOX.md +200 -0
  56. package/.agent/workflows/LEGACY/analyze_component.md +141 -0
  57. package/.agent/workflows/LEGACY/build_vibecode_project.md +154 -0
  58. package/.agent/workflows/LEGACY/deep_code_audit.md +79 -0
  59. package/.agent/workflows/LEGACY/gemini-orchestrate.md +63 -0
  60. package/.agent/workflows/LEGACY/git_worktree.md +71 -0
  61. package/.agent/workflows/LEGACY/init_smart_ops.md +101 -0
  62. package/.agent/workflows/LEGACY/multi_agent_strategy.md +62 -0
  63. package/.agent/workflows/LEGACY/orchestrate.md +321 -0
  64. package/.agent/workflows/LEGACY/seo_ready.md +249 -0
  65. package/.agent/workflows/LEGACY/vibe-orchestrator.md +305 -0
  66. package/.agent/workflows/LEGACY/youtube-phase1-strategy.md +224 -0
  67. package/.agent/workflows/LEGACY/youtube-phase2-packaging.md +148 -0
  68. package/.agent/workflows/LEGACY/youtube-phase3-scripting.md +197 -0
  69. package/.agent/workflows/LEGACY/youtube-phase3.5-shorts.md +271 -0
  70. package/.agent/workflows/LEGACY/youtube-phase4-production.md +193 -0
  71. package/.agent/workflows/LEGACY/youtube-phase5-repurposing.md +159 -0
  72. package/.agent/workflows/LEGACY/youtube-pipeline.md +161 -0
  73. package/.agent/workflows/README.md +349 -0
  74. package/.agent/workflows/Vercel Ai SDK.md +34083 -0
  75. package/.agent/workflows/agent_reset.md +138 -0
  76. package/.agent/workflows/build_vibecode_project_v2.md +158 -0
  77. package/.agent/workflows/escalate.md +112 -0
  78. package/.agent/workflows/init_vibecode_design.md +98 -0
  79. package/.agent/workflows/init_vibecode_genesis.md +137 -0
  80. package/.agent/workflows/migrate.md +135 -0
  81. package/.agent/workflows/prime_agent.md +211 -0
  82. package/.agent/workflows/reverse_genesis.md +132 -0
  83. package/.agent/workflows/review_code.md +133 -0
  84. package/.agent/workflows/spawn-jstar-code-review.md +121 -0
  85. package/.agent/workflows/spawn_task.md +187 -0
  86. package/.agent/workflows/sync_docs.md +90 -0
  87. package/Legacy (Manual Method)/0 VibeCode User Manual.md +173 -0
  88. package/Legacy (Manual Method)/1 Project Genesis Protocol The VibeCode Workflow.md +89 -0
  89. package/Legacy (Manual Method)/2/342/234/250 ULTIMATE ORCHESTRATION PROMPT/342/234/250.md" +114 -0
  90. package/Legacy (Manual Method)/3 Design System Genesis Protocol.md +75 -0
  91. package/Legacy (Manual Method)/3.1.1 my_design_system_rules.md +177 -0
  92. package/Legacy (Manual Method)/3.1.2 Material You M3 Genesis Protocol.md +73 -0
  93. package/Legacy (Manual Method)/4 The Ultimate GitHub Issue Meta-Prompt Template.md +54 -0
  94. package/Legacy (Manual Method)/5 The Escalation & Handoff Protocol.md +97 -0
  95. package/Legacy (Manual Method)/8 The Seamless Migration Meta-Prompt (Your Reusable Tool).md +38 -0
  96. package/Legacy (Manual Method)/9 The Reverse Genesis Protocol.md +75 -0
  97. package/README.md +209 -0
  98. package/VibeCode-Agents (e.g Kilo-code)/README.md +142 -0
  99. package/VibeCode-Agents (e.g Kilo-code)/vibe-analyzer.yaml +254 -0
  100. package/VibeCode-Agents (e.g Kilo-code)/vibe-architect.yaml +397 -0
  101. package/VibeCode-Agents (e.g Kilo-code)/vibe-auditor.yaml +325 -0
  102. package/VibeCode-Agents (e.g Kilo-code)/vibe-builder.yaml +472 -0
  103. package/VibeCode-Agents (e.g Kilo-code)/vibe-designer.yaml +305 -0
  104. package/VibeCode-Agents (e.g Kilo-code)/vibe-documentor.yaml +222 -0
  105. package/VibeCode-Agents (e.g Kilo-code)/vibe-escalator.yaml +255 -0
  106. package/VibeCode-Agents (e.g Kilo-code)/vibe-isolator.yaml +332 -0
  107. package/VibeCode-Agents (e.g Kilo-code)/vibe-onboarder.yaml +335 -0
  108. package/VibeCode-Agents (e.g Kilo-code)/vibe-orchestrator.yaml +365 -0
  109. package/VibeCode-Agents (e.g Kilo-code)/vibe-orchestrator_legacy.yaml +284 -0
  110. package/VibeCode-Agents (e.g Kilo-code)/vibe-orchestrator_v1.yaml +336 -0
  111. package/VibeCode-Agents (e.g Kilo-code)/vibe-primer.yaml +213 -0
  112. package/VibeCode-Agents (e.g Kilo-code)/vibe-reviewer.yaml +233 -0
  113. package/VibeCode-Agents (e.g Kilo-code)/vibe-spawner.yaml +259 -0
  114. package/bin/vibesuite.js +2 -0
  115. package/package.json +43 -0
  116. package/src/cli.js +159 -0
  117. package/src/utils.js +76 -0
@@ -0,0 +1,18 @@
1
+ 'use strict';
2
+
3
+ export default (request, searchType, { processor, objectConstructor }) => {
4
+ const resultsPromise = processor(request);
5
+
6
+ return (reqObj, cb) => {
7
+ const {
8
+ cbFunc,
9
+ obj,
10
+ } = objectConstructor(reqObj, cb);
11
+
12
+ if (obj instanceof Error) return Promise.reject(cbFunc(obj));
13
+
14
+ return resultsPromise(searchType, obj)
15
+ .then(res => cbFunc(null, res))
16
+ .catch(err => Promise.reject(cbFunc(err)));
17
+ };
18
+ };
@@ -0,0 +1,27 @@
1
+ 'use strict';
2
+ import api from './api';
3
+ import request from './request';
4
+ import { getInterestResults, getTrendingResults,
5
+ constructInterestObj, constructTrendingObj } from './utilities';
6
+
7
+ const interestHandler = {
8
+ processor: getInterestResults,
9
+ objectConstructor: constructInterestObj,
10
+ };
11
+
12
+ const trendHandler = {
13
+ processor: getTrendingResults,
14
+ objectConstructor: constructTrendingObj,
15
+ };
16
+
17
+ const apiRequest = api.bind(this, request);
18
+
19
+ export default {
20
+ autoComplete: apiRequest('Auto complete', interestHandler),
21
+ dailyTrends: apiRequest('Daily trends', trendHandler),
22
+ interestByRegion: apiRequest('Interest by region', interestHandler),
23
+ interestOverTime: apiRequest('Interest over time', interestHandler),
24
+ realTimeTrends: apiRequest('Real time trends', trendHandler),
25
+ relatedQueries: apiRequest('Related queries', interestHandler),
26
+ relatedTopics: apiRequest('Related topics', interestHandler),
27
+ };
@@ -0,0 +1,69 @@
1
+ 'use strict';
2
+ import https from 'https';
3
+ import querystring from 'querystring';
4
+
5
+ // cache of the cookie - avoid re-requesting on subsequent requests.
6
+ let cookieVal;
7
+
8
+ // simpler request method for avoiding double-promise confusion
9
+ function rereq(options, done) {
10
+ let req;
11
+
12
+ req = https.request(options, (res) => {
13
+ let chunk = '';
14
+
15
+ res.on('data', (data) => {
16
+ chunk += data;
17
+ });
18
+ res.on('end', () => {
19
+ done(null, chunk.toString('utf8'));
20
+ });
21
+ });
22
+ req.on('error', (e) => {
23
+ done(e);
24
+ });
25
+ req.end();
26
+ }
27
+
28
+ export default function request({method, host, path, qs, agent}) {
29
+ const options = {
30
+ host,
31
+ method,
32
+ path: `${path}?${querystring.stringify(qs)}`,
33
+ };
34
+
35
+ if (agent) options.agent = agent;
36
+ // will use cached cookieVal if set on 429 error
37
+ if (cookieVal) options.headers = {'cookie': cookieVal};
38
+
39
+ return new Promise((resolve, reject) => {
40
+ const req = https.request(options, (res) => {
41
+ let chunk = '';
42
+
43
+ res.on('data', (data) => {
44
+ chunk += data;
45
+ });
46
+
47
+ res.on('end', () => {
48
+ if (res.statusCode === 429 && res.headers['set-cookie']) {
49
+ // Fix for the "too many requests" issue
50
+ // Look for the set-cookie header and re-request
51
+ cookieVal = res.headers['set-cookie'][0].split(';')[0];
52
+ options.headers = {'cookie': cookieVal};
53
+ rereq(options, function(err, response) {
54
+ if (err) return reject(err);
55
+ resolve(response);
56
+ });
57
+ } else {
58
+ resolve(chunk.toString('utf8'));
59
+ }
60
+ });
61
+ });
62
+
63
+ req.on('error', (e) => {
64
+ reject(e);
65
+ });
66
+
67
+ req.end();
68
+ });
69
+ }
@@ -0,0 +1,395 @@
1
+ 'use strict';
2
+ export function isLessThan7Days(date1, date2) {
3
+ return (Math.abs(date2 - date1) / (24 * 60 * 60 * 1000)) < 7;
4
+ }
5
+
6
+ export function convertDateToString(d, shouldIncludeTime, formatWithoutDashes) {
7
+ let month = (d.getUTCMonth() + 1).toString();
8
+ let day = d.getUTCDate().toString();
9
+
10
+ const dash = formatWithoutDashes ? '' : '-';
11
+
12
+ month = month.length < 2 ? '0' + month : month;
13
+ day = formatWithoutDashes && day.length < 2 ? '0' + day : day;
14
+
15
+ const year = d.getUTCFullYear().toString();
16
+ const hour = d.getUTCHours();
17
+ const minute = d.getUTCMinutes();
18
+
19
+ if (shouldIncludeTime) {
20
+ return `${year}${dash}${month}${dash}${day}T${hour}\\:${minute}\\:00`;
21
+ }
22
+
23
+ return `${year}${dash}${month}${dash}${day}`;
24
+ }
25
+
26
+ export function formatTime(obj) {
27
+ if (obj.startTime && obj.endTime && obj.startTime > obj.endTime) {
28
+ const temp = obj.startTime;
29
+
30
+ obj.startTime = obj.endTime;
31
+ obj.endTime = temp;
32
+ }
33
+
34
+ if (!obj.endTime) obj.endTime = new Date();
35
+ if (!obj.startTime) obj.startTime = new Date('2004-01-01');
36
+
37
+ const shouldIncludeTime = isLessThan7Days(obj.startTime, obj.endTime);
38
+
39
+ const startTime = convertDateToString(obj.startTime,
40
+ shouldIncludeTime && obj.granularTimeResolution);
41
+ const endTime = convertDateToString(obj.endTime,
42
+ shouldIncludeTime && obj.granularTimeResolution);
43
+
44
+ obj.time = `${startTime} ${endTime}`;
45
+ return obj;
46
+ }
47
+
48
+ function validateGeo(obj) {
49
+ const multiGeoKeyword = Array.isArray(obj.geo) && Array.isArray(obj.keyword);
50
+
51
+ if (multiGeoKeyword && obj.geo.length !== obj.keyword.length) {
52
+ return new Error('Geo length must be equal to keyword length');
53
+ }
54
+
55
+ return obj;
56
+ }
57
+
58
+ function validateTime(obj) {
59
+ if (obj.startTime && !(obj.startTime instanceof Date)) {
60
+ obj = new Error('startTime must be a Date object');
61
+ }
62
+
63
+ if (obj.endTime && !(obj.endTime instanceof Date)) {
64
+ obj = new Error('endTime must be a Date object');
65
+ }
66
+
67
+ return obj;
68
+ }
69
+
70
+ const invalidCb = cb => !!cb && typeof cb !== 'function';
71
+
72
+ function validateObj(obj, cbFunc) {
73
+ if (!obj) {
74
+ obj = new Error('Must supply an object');
75
+ } else if (!!obj && typeof obj !== 'object' || Array.isArray(obj)) {
76
+ obj = new Error('Must supply an object');
77
+ } else if (!obj.keyword) {
78
+ obj = new Error('Must have a keyword field');
79
+ }
80
+
81
+ if (invalidCb(cbFunc)) {
82
+ obj = new Error('Callback function must be a function');
83
+ }
84
+
85
+ obj = validateGeo(obj);
86
+ obj = validateTime(obj);
87
+
88
+ return obj;
89
+ }
90
+
91
+ /**
92
+ * Validates the obj and callback
93
+ * and sets defaults for anything that haven't been supplied
94
+ * @param {Object} obj - the object with .keyword property
95
+ * @param {Function} cb - an optional callback function
96
+ * @return {Object} - object with decorated obj and cbFunc properties
97
+ */
98
+ export function constructInterestObj(obj, cbFunc) {
99
+
100
+ if (typeof obj === 'function') cbFunc = obj;
101
+
102
+ obj = validateObj(obj, cbFunc);
103
+
104
+ if (!obj.hl) obj.hl = 'en-US';
105
+ if (!obj.category) obj.category = 0;
106
+ if (!obj.timezone) obj.timezone = new Date().getTimezoneOffset();
107
+
108
+ const possibleProperties = ['images', 'news', 'youtube', 'froogle', ''];
109
+
110
+ if (possibleProperties.indexOf(obj.property) === -1) {
111
+ obj.property = '';
112
+ }
113
+
114
+ if (!cbFunc) {
115
+ cbFunc = (err, res) => {
116
+ if (err) return err;
117
+ return res;
118
+ };
119
+ }
120
+
121
+ obj = formatTime(obj);
122
+
123
+ return {
124
+ cbFunc,
125
+ obj,
126
+ };
127
+ }
128
+
129
+ export function formatResolution(resolution = '') {
130
+ const resolutions = ['COUNTRY', 'REGION', 'CITY', 'DMA'];
131
+ const isResValid = resolutions.some((res) => {
132
+ return res === resolution.toUpperCase();
133
+ });
134
+
135
+ if (isResValid) return resolution.toUpperCase();
136
+ return '';
137
+ }
138
+
139
+ /**
140
+ * Parse the result of the google api as JSON
141
+ * Throws an Error if the JSON is invalid
142
+ * @param {String} results
143
+ * @return {Object}
144
+ */
145
+ export function parseResults(results) {
146
+ // If this fails, you've hit the rate limit or Google has changed something
147
+ try {
148
+ return JSON.parse(results.slice(4)).widgets;
149
+ } catch (e) {
150
+ // Throw the JSON error e.g.
151
+ // { message: 'Unexpected token C in JSON at position 0',
152
+ // requestBody: '<!DOCTYPE html><html>...'}
153
+ e.requestBody = results;
154
+ throw e;
155
+ }
156
+ }
157
+
158
+ /**
159
+ * Create the array of comparisonItems to be used
160
+ * @param {Object} obj The query obj with .keyword property and optionally
161
+ * the .geo property
162
+ * @return {Array} Returns an array of comparisonItems
163
+ */
164
+ export function formatComparisonItems(obj) {
165
+ const isMultiRegion = obj.geo && Array.isArray(obj.geo);
166
+ let isMultiKeyword = Array.isArray(obj.keyword);
167
+
168
+ // Duplicate keywords to match the length of geo
169
+ if (isMultiRegion && !isMultiKeyword) {
170
+ obj.keyword = Array(obj.geo.length).fill(obj.keyword);
171
+ isMultiKeyword = true;
172
+ }
173
+
174
+ // If we are requesting an array of keywords for comparison
175
+ if (isMultiKeyword) {
176
+
177
+ // Map the keywords to the items array
178
+ let items = obj.keyword.reduce((arr, keyword) => {
179
+ // Add the keyword to the array
180
+ arr.push({ ...obj, keyword });
181
+
182
+ return arr;
183
+ }, []);
184
+
185
+ // Is there an array of regions as well?
186
+ if (isMultiRegion) {
187
+
188
+ obj.geo.forEach((region, index) => {
189
+ items[index].geo = region;
190
+ });
191
+ }
192
+
193
+ return items;
194
+ }
195
+
196
+ return [obj];
197
+ }
198
+
199
+ export function getInterestResults(request) {
200
+ return (searchType, obj) => {
201
+ const map = {
202
+ 'Auto complete': {
203
+ path: `/trends/api/autocomplete/${encodeURIComponent(obj.keyword)}`,
204
+ },
205
+ 'Interest over time': {
206
+ path: '/trends/api/widgetdata/multiline',
207
+ _id: 'TIMESERIES',
208
+ },
209
+ 'Interest by region': {
210
+ path: '/trends/api/widgetdata/comparedgeo',
211
+ resolution: formatResolution(obj.resolution),
212
+ _id: 'GEO_MAP',
213
+ },
214
+ 'Related topics': {
215
+ path: '/trends/api/widgetdata/relatedsearches',
216
+ _id: 'RELATED_TOPICS',
217
+ },
218
+ 'Related queries': {
219
+ path: '/trends/api/widgetdata/relatedsearches',
220
+ _id: 'RELATED_QUERIES',
221
+ },
222
+ };
223
+
224
+ const options = {
225
+ method: 'GET',
226
+ host: 'trends.google.com',
227
+ path: '/trends/api/explore',
228
+ qs: {
229
+ hl: obj.hl,
230
+ req: JSON.stringify({
231
+ comparisonItem: formatComparisonItems(obj),
232
+ category: obj.category,
233
+ property: obj.property,
234
+ }),
235
+ tz: obj.timezone,
236
+ },
237
+ };
238
+
239
+ if (obj.agent) options.agent = obj.agent;
240
+
241
+ const { path, resolution, _id } = map[searchType];
242
+
243
+ return request(options)
244
+ .then((results) => {
245
+ const parsedResults = parseResults(results);
246
+
247
+ /**
248
+ * Search for the id that matches the search result
249
+ * Auto complete does not have results on initial query
250
+ * so just pass the first available result with request
251
+ */
252
+ const resultObj = parsedResults.find(({ id = '', request }) => {
253
+ return id.indexOf(_id) > -1 ||
254
+ (searchType === 'Auto complete' && request);
255
+ });
256
+
257
+ if (!resultObj) {
258
+ const errObj = {
259
+ message: 'Available widgets does not contain selected api type',
260
+ requestBody: results,
261
+ };
262
+
263
+ throw errObj;
264
+ }
265
+
266
+ let req = resultObj.request;
267
+ const token = resultObj.token;
268
+
269
+ if (resolution) req.resolution = resolution;
270
+ req.requestOptions.category = obj.category;
271
+ req.requestOptions.property = obj.property;
272
+ req = JSON.stringify(req);
273
+
274
+ const nextOptions = {
275
+ path,
276
+ method: 'GET',
277
+ host: 'trends.google.com',
278
+ qs: {
279
+ hl: obj.hl,
280
+ req,
281
+ token,
282
+ tz: obj.timezone,
283
+ },
284
+ };
285
+
286
+ if (obj.agent) nextOptions.agent = obj.agent;
287
+
288
+ return request(nextOptions);
289
+ })
290
+ .then((res) => {
291
+ try {
292
+ /** JSON.parse will decode unicode */
293
+ const results = JSON.stringify(JSON.parse(res.slice(5)));
294
+
295
+ return results;
296
+ } catch (e) {
297
+ /** throws if not valid JSON, so just return unaltered res string */
298
+ return res;
299
+ }
300
+ });
301
+ };
302
+ }
303
+
304
+ export function getTrendingResults(request) {
305
+ return (searchType, obj) => {
306
+ const searchTypeMap = {
307
+ 'Daily trends': {
308
+ path: '/trends/api/dailytrends',
309
+ extraParams: {
310
+ ed: convertDateToString(obj.trendDate, false, true),
311
+ ns: obj.ns,
312
+ },
313
+ },
314
+ 'Real time trends': {
315
+ path: '/trends/api/realtimetrends',
316
+ extraParams: {
317
+ fi: 0,
318
+ fs: 0,
319
+ ri: 300, // # of trending stories IDs returned
320
+ rs: 20,
321
+ sort: 0,
322
+ },
323
+ },
324
+ };
325
+
326
+ const options = {
327
+ method: 'GET',
328
+ host: 'trends.google.com',
329
+ path: searchTypeMap[searchType].path,
330
+ qs: {
331
+ hl: obj.hl,
332
+ tz: obj.timezone,
333
+ geo: obj.geo,
334
+ cat: obj.category,
335
+ },
336
+ };
337
+
338
+ if (obj.agent) options.agent = obj.agent;
339
+
340
+ options.qs = {...options.qs, ...searchTypeMap[searchType].extraParams};
341
+
342
+ return request(options)
343
+ .then((res) => {
344
+ try {
345
+ /** JSON.parse will decode unicode */
346
+ return JSON.stringify(JSON.parse(res.slice(5)));
347
+ } catch (e) {
348
+ /** throws if not valid JSON, so just return unaltered res string */
349
+ return res;
350
+ }
351
+ });
352
+ };
353
+ }
354
+
355
+ export function constructTrendingObj(obj, cbFunc) {
356
+ if (typeof obj === 'function') cbFunc = obj;
357
+
358
+ if (!obj || !!obj && typeof obj !== 'object' || Array.isArray(obj)) {
359
+ obj = new Error('Must supply an object');
360
+ } else {
361
+ if (!obj.trendDate || !(obj.trendDate instanceof Date)) {
362
+ delete obj.trendDate;
363
+ }
364
+
365
+ const date = new Date();
366
+ const defaults = { hl: 'en-US',
367
+ category: 'all',
368
+ timezone: date.getTimezoneOffset(),
369
+ trendDate: date,
370
+ ns: 15,
371
+ };
372
+
373
+ obj = { ...defaults, ...obj }; // Merge user params into obj with defaults
374
+ }
375
+
376
+ if (invalidCb(cbFunc)) {
377
+ obj = new Error('Callback function must be a function');
378
+ }
379
+
380
+ if (!obj.geo) {
381
+ obj = new Error('Must supply an geographical location (geo)');
382
+ }
383
+
384
+ if (!cbFunc) {
385
+ cbFunc = (err, res) => {
386
+ if (err) return err;
387
+ return res;
388
+ };
389
+ }
390
+
391
+ return {
392
+ cbFunc,
393
+ obj,
394
+ };
395
+ }
@@ -0,0 +1,31 @@
1
+ lockfileVersion: '9.0'
2
+
3
+ settings:
4
+ autoInstallPeers: true
5
+ excludeLinksFromLockfile: false
6
+
7
+ importers:
8
+
9
+ .:
10
+ dependencies:
11
+ commander:
12
+ specifier: ^12.0.0
13
+ version: 12.1.0
14
+ google-trends-api:
15
+ specifier: ^4.9.2
16
+ version: 4.9.2
17
+
18
+ packages:
19
+
20
+ commander@12.1.0:
21
+ resolution: {integrity: sha512-Vw8qHK3bZM9y/P10u3Vib8o/DdkvA2OtPtZvD871QKjy74Wj1WSKFILMPRPSdUSx5RFK1arlJzEtA4PkFgnbuA==}
22
+ engines: {node: '>=18'}
23
+
24
+ google-trends-api@4.9.2:
25
+ resolution: {integrity: sha512-gjVSHCM8B7LyAAUpXb4B0/TfnmpwQ2z1w/mQ2bL0AKpr2j3gLS1j2YOnifpfsGJRxAGXB/NoC+nGwC5qSnZIiA==}
26
+
27
+ snapshots:
28
+
29
+ commander@12.1.0: {}
30
+
31
+ google-trends-api@4.9.2: {}
@@ -0,0 +1,25 @@
1
+ {
2
+ "lastValidatedTimestamp": 1769247054358,
3
+ "projects": {},
4
+ "pnpmfiles": [],
5
+ "settings": {
6
+ "autoInstallPeers": true,
7
+ "dedupeDirectDeps": false,
8
+ "dedupeInjectedDeps": true,
9
+ "dedupePeerDependents": true,
10
+ "dev": true,
11
+ "excludeLinksFromLockfile": false,
12
+ "hoistPattern": [
13
+ "*"
14
+ ],
15
+ "hoistWorkspacePackages": true,
16
+ "injectWorkspacePackages": false,
17
+ "linkWorkspacePackages": false,
18
+ "nodeLinker": "isolated",
19
+ "optional": true,
20
+ "preferWorkspacePackages": false,
21
+ "production": true,
22
+ "publicHoistPattern": []
23
+ },
24
+ "filteredInstall": false
25
+ }
@@ -0,0 +1,17 @@
1
+ {
2
+ "name": "google-trends-cli",
3
+ "version": "1.0.0",
4
+ "description": "CLI for Google Trends research automation",
5
+ "main": "search.js",
6
+ "type": "module",
7
+ "scripts": {
8
+ "search": "node search.js"
9
+ },
10
+ "keywords": ["google-trends", "youtube", "research"],
11
+ "author": "J STAR FILMS",
12
+ "license": "MIT",
13
+ "dependencies": {
14
+ "commander": "^12.0.0",
15
+ "google-trends-api": "^4.9.2"
16
+ }
17
+ }
@@ -0,0 +1,31 @@
1
+ lockfileVersion: '9.0'
2
+
3
+ settings:
4
+ autoInstallPeers: true
5
+ excludeLinksFromLockfile: false
6
+
7
+ importers:
8
+
9
+ .:
10
+ dependencies:
11
+ commander:
12
+ specifier: ^12.0.0
13
+ version: 12.1.0
14
+ google-trends-api:
15
+ specifier: ^4.9.2
16
+ version: 4.9.2
17
+
18
+ packages:
19
+
20
+ commander@12.1.0:
21
+ resolution: {integrity: sha512-Vw8qHK3bZM9y/P10u3Vib8o/DdkvA2OtPtZvD871QKjy74Wj1WSKFILMPRPSdUSx5RFK1arlJzEtA4PkFgnbuA==}
22
+ engines: {node: '>=18'}
23
+
24
+ google-trends-api@4.9.2:
25
+ resolution: {integrity: sha512-gjVSHCM8B7LyAAUpXb4B0/TfnmpwQ2z1w/mQ2bL0AKpr2j3gLS1j2YOnifpfsGJRxAGXB/NoC+nGwC5qSnZIiA==}
26
+
27
+ snapshots:
28
+
29
+ commander@12.1.0: {}
30
+
31
+ google-trends-api@4.9.2: {}