Skip to content

Marketing skills for Claude Code and AI agents. CRO, copywriting, SEO, analytics, and growth engineering.

fix(close): preserve exact integer opportunity amounts

Rudy Celeklie78fa3cf00b1
diff --git a/.claude-plugin/marketplace.json b/.claude-plugin/marketplace.json
index 39ddc4c..68a230d 100644
--- a/.claude-plugin/marketplace.json
+++ b/.claude-plugin/marketplace.json
@@ -6,7 +6,7 @@
},
"metadata": {
"description": "Marketing skills for AI agents — conversion optimization, copywriting, SEO, paid ads, and growth",
- "version": "2.11.26",
+ "version": "2.11.27",
"repository": "https://github.com/coreyhaines31/marketingskills"
},
"plugins": [
diff --git a/.claude-plugin/plugin.json b/.claude-plugin/plugin.json
index f1a5cf8..aabe26f 100644
--- a/.claude-plugin/plugin.json
+++ b/.claude-plugin/plugin.json
@@ -1,7 +1,7 @@
{
"name": "marketing-skills",
"description": "Marketing skills for AI agents — conversion optimization, copywriting, SEO, paid ads, ad creative, and growth",
- "version": "2.11.26",
+ "version": "2.11.27",
"author": {
"name": "Corey Haines"
},
diff --git a/.codex-plugin/plugin.json b/.codex-plugin/plugin.json
index 45d9d89..9cd1f4c 100644
--- a/.codex-plugin/plugin.json
+++ b/.codex-plugin/plugin.json
@@ -1,7 +1,7 @@
{
"name": "marketing-skills",
"description": "Marketing skills for AI agents — conversion optimization, copywriting, SEO, paid ads, ad creative, and growth",
- "version": "2.11.26",
+ "version": "2.11.27",
"author": {
"name": "Corey Haines"
},
diff --git a/VERSIONS.md b/VERSIONS.md
index dc6d5ce..09291c9 100644
--- a/VERSIONS.md
+++ b/VERSIONS.md
@@ -57,6 +57,10 @@ Current versions of all skills. Agents can compare against local versions to che
## Recent Changes
+### 2.11.27 (2026-10-10)
+
+- Reject lossy opportunity amount parsing before Close requests while retaining exact integer inputs.
+
### 2.11.26 (2026-10-08)
- **lead-magnets** (2.0.0 → 2.1.0): new `references/content-to-skill.md` (plus corpus design and release companions) on packaging a course, webinar series, podcast, or newsletter archive you own as an installable agent skill: a new kind of lead magnet. From @rudycelekli's #725 (closes #432), folded in rather than added as a new skill. Triggers added: 'course as a skill,' 'package our content as an agent skill.' **ai-seo** (2.7.5 → 2.7.6) points to it.
diff --git a/tests/clis/close-opportunity-value.test.cjs b/tests/clis/close-opportunity-value.test.cjs
new file mode 100644
index 0000000..f65838f
--- /dev/null
+++ b/tests/clis/close-opportunity-value.test.cjs
@@ -0,0 +1,20 @@
+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/close.js')
+function run(value,preview=false){
+ const args=['opportunities','create','--lead-id','lead_fixture','--value'];if(value!==undefined)args.push(value);if(preview)args.push('--dry-run')
+ const source=`global.fetch=async(url,opts)=>{process.stderr.write('FETCH_CALLED');return {status:200,text:async()=>JSON.stringify({body:JSON.parse(opts.body),headers:opts.headers})}};process.argv=['node',${JSON.stringify(cli)},...${JSON.stringify(args)}];require(${JSON.stringify(cli)})`
+ return spawnSync(process.execPath,['-e',source],{encoding:'utf8',env:{...process.env,CLOSE_API_KEY:'fixture-key'},timeout:5000})
+}
+test('rejects lossy or nonnumeric opportunity values before delivery or preview',()=>{
+ for(const value of [undefined,'',' ','12.9','12abc','NaN','Infinity','1e309','9007199254740992'])for(const preview of [false,true]){
+ const r=run(value,preview);assert.equal(r.status,1,`${value}: ${r.stdout}`);assert.equal(r.stderr.includes('FETCH_CALLED'),false);assert.match(JSON.parse(r.stderr).error,/safe integer/)
+ }
+})
+test('retains exact integer amounts including zero and scientific notation',()=>{
+ for(const value of ['0','1250','-25','1e3','10.0','9007199254740991'])for(const preview of [false,true]){
+ const r=run(value,preview);assert.equal(r.status,0,r.stderr);const output=JSON.parse(r.stdout);assert.equal(output.body.value,Number(value));assert.equal(output.body.lead_id,'lead_fixture');assert.equal(output.headers.Authorization,preview?'Basic ***':`Basic ${Buffer.from('fixture-key:').toString('base64')}`)
+ }
+})
diff --git a/tools/clis/close.js b/tools/clis/close.js
index e11aa36..5369329 100755
--- a/tools/clis/close.js
+++ b/tools/clis/close.js
@@ -164,7 +164,11 @@ async function main() {
const value = args.value
if (!leadId) { result = { error: '--lead-id required' }; break }
if (!value) { result = { error: '--value required (in cents)' }; break }
- const body = { lead_id: leadId, value: parseInt(value) }
+ const amount = Number(value)
+ if (typeof value !== 'string' || !value.trim() || !Number.isSafeInteger(amount)) {
+ throw new Error('--value must be a safe integer amount in cents')
+ }
+ const body = { lead_id: leadId, value: amount }
const statusId = args['status-id'] || args.status
if (['active', 'won', 'lost'].includes(statusId)) {
result = { error: '--status-id must be an opportunity status ID (stat_...), not a status type. Retrieve IDs from GET /status/opportunity/.' }