Marketing skills for Claude Code and AI agents. CRO, copywriting, SEO, analytics, and growth engineering.
JavaScript agent-skillsai-agentsai-seoclaudeclaude-codeclaude-code-pluginclaude-skillscodexcontent-marketingconversion-rate-optimizationcopywritingcursoremail-marketinggenerative-engine-optimizationgrowth-marketingmarketingmarketing-automationsaas-marketingseoskill-md
fix(github): export formula-like profiles as CSV literals
Rudy Celeklifcd0e618c054
diff --git a/tests/prospect-csv.test.cjs b/tests/prospect-csv.test.cjsnew file mode 100644index 0000000..8d6f135--- /dev/null+++ b/tests/prospect-csv.test.cjs@@ -0,0 +1,38 @@+const { test } = require('node:test')+const assert = require('node:assert/strict')+const { spawnSync } = require('node:child_process')+const path = require('node:path')+const cli = path.resolve(__dirname, '../tools/clis/github-prospects.js')+function exportUsers(users, format) {+ const source = `global.fetch = async () => ({ ok: true, status: 200, headers: new Headers(), json: async () => ${JSON.stringify(users)} }); process.argv = ['node', ${JSON.stringify(cli)}, 'stargazers', 'example/repo', '--format', ${JSON.stringify(format)}]; require(${JSON.stringify(cli)});`+ const result = spawnSync(process.execPath, ['-e', source], { encoding: 'utf8' })+ assert.equal(result.status, 0, result.stderr)+ return result.stdout.trimEnd()+}+// Parse CSV independently to check the actual exported cells, not source text.+function cells(row) {+ const result = []; let field = ''; let quoted = false+ for (let i = 0; i < row.length; i++) {+ const ch = row[i]+ if (ch === '"') {+ if (quoted && row[i+1] === '"') { field += '"'; i++ }+ else quoted = !quoted+ } else if (ch === ',' && !quoted) { result.push(field); field = '' }+ else field += ch+ }+ result.push(field); return result+}+for (const value of ['=1+1', '+1+1', '-1+1', '@SUM(1,2)', '\t=1+1', '\r=1+1', '\n=1+1']) {+ test(`CSV exports formula-like profile text as literal: ${JSON.stringify(value)}`, () => {+ const rows = exportUsers([{login: 'user', name: value}], 'csv').split('\n')+ assert.ok(cells(rows[1])[1].startsWith("'"))+ })+}+test('ordinary commas and quotes remain valid CSV and numeric fields stay numeric', () => {+ const row = cells(exportUsers([{ login: 'user', name: 'Doe, "Jane"', company: 'Ordinary', followers: 12 }], 'csv').split('\n')[1])+ assert.equal(row[1], 'Doe, "Jane"'); assert.equal(row[2], 'Ordinary'); assert.equal(row[9], '12')+})+test('JSON preserves the original profile data', () => {+ const user = { login: 'user', name: '=1+1' }+ assert.deepEqual(JSON.parse(exportUsers([user], 'json')).users, [user])+})diff --git a/tools/clis/github-prospects.js b/tools/clis/github-prospects.jsindex e416381..e5b3b3b 100755--- a/tools/clis/github-prospects.js+++ b/tools/clis/github-prospects.js@@ -130,7 +130,13 @@ function toCSV(users) {const cols = ['login', 'name', 'company', 'email', 'blog', 'location', 'bio', 'twitter_username', 'public_repos', 'followers', 'created_at', 'html_url']const escape = (v) => {if (v === null || v === undefined) return ''- const s = String(v).replace(/\r?\n/g, ' ')+ // Public profile strings can be spreadsheet formulas. Quoting alone does+ // not prevent evaluation when the CSV is opened in a spreadsheet.+ const raw = String(v)+ const literal = typeof v === 'string' && /^[\s]*[=+@-]/.test(raw)+ ? "'" + raw+ : raw+ const s = literal.replace(/[\r\n]/g, ' ')if (s.includes(',') || s.includes('"')) return `"${s.replace(/"/g, '""')}"`return s}diff --git a/tools/integrations/github.md b/tools/integrations/github.mdindex fc04a1b..d2b3c0a 100644--- a/tools/integrations/github.md+++ b/tools/integrations/github.md@@ -180,3 +180,10 @@ See `skills/prospecting/references/saas-prospecting.md` and `data-sources.md` fo- prospecting (primary use case)- cold-email (downstream outreach)- competitor-profiling (deeper account-level research on individual stargazers worth pursuing)++### CSV export of public profiles++`github-prospects.js --format csv` prefixes formula-like profile strings with+an apostrophe so spreadsheet imports treat them as text. Numeric counts remain+numeric. Use the default JSON format when you need the original unmodified+profile values. CSV quoting alone does not prevent spreadsheet formula execution.