@farthershore/cli 0.3.13 → 0.3.14
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.
- package/dist/index.js +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -398,7 +398,7 @@ Example:
|
|
|
398
398
|
`).action(async(i,r,o)=>{await pi(t,e(),o.product,o.env,i,o.dryRun,(a,s)=>{Zr(s,"feature_removed",o),a.features=Ur(a,"features").filter(c=>c!==r)})}),n.command("remove <key>").option(kt,$t).option(xt,wt).option(Lr,"Use grandfather to keep existing subscribers on old compiled plans").option("--dry-run",Mt).addHelpText("after",`
|
|
399
399
|
Example:
|
|
400
400
|
farthershore plan remove starter --dry-run --format json
|
|
401
|
-
`).action(async(i,r)=>{let o=e(),a=await Z(t,o,r.product,r.env),s=await re(o,a.productId,a.env);Zr(s,"plan_removed",r),s.plans=ui(s).filter(c=>c.key!==i),await ve(t,o,a.productId,s,{dryRun:r.dryRun,env:a.env,message:`Plan "${i}" removed`})})}function dE(t,e,n){let i=e.free?0:e.priceMonthly??0,r=fE(n,e.free,e.meter.length>0),o={key:t,name:e.name??bE(t),free:e.free===!0,price:{monthly:i,currency:"USD"},pricing:{model:r,monthlyPriceCents:i,billingInterval:"month"},usage:{meters:e.meter},features:e.feature,limits:e.limit.map(P$)};return e.creditsMonthlyMicros!==void 0&&(o.credits={monthlyIncludedMicros:e.creditsMonthlyMicros}),o}function fE(t,e,n){let i=mE(t);return(e||n)&&i.includes("included_usage")?"included_usage":!n&&i.includes("flat_rate")?"flat_rate":i.includes("included_usage")?"included_usage":i.includes("pay_as_you_go")?"pay_as_you_go":i.includes("configurable_usage")?"configurable_usage":"flat_rate"}function mE(t){let n=G_(t);if(n&&n.length>0)return n;switch(t){case"free_trial":case"flat_subscription":return["flat_rate"];case"included_usage":case"subscription_overage":case"prepaid_credits":return["included_usage","configurable_usage"];case"pay_as_you_go":return["pay_as_you_go","configurable_usage"];default:return["flat_rate"]}}function pE(t){let e=t.billing;if(typeof e=="object"&&e!==null&&!Array.isArray(e)){let n=e.strategy;if(typeof n=="string")return n}return"flat_subscription"}async function pi(t,e,n,i,r,o,a){let s=await Z(t,e,n,i),c=await re(e,s.productId,s.env);a(li(c,r),c),await ve(t,e,s.productId,c,{dryRun:o,env:s.env,message:`Plan "${r}" updated`})}function Zr(t,e,n){!e||!n.existingSubscribers||zp(t,e,b$(n.existingSubscribers),{ackPriceIncrease:n.ackPriceIncrease,ackEntitlementReduction:n.ackEntitlementReduction})}function gE(t){let e=t.price;if(e&&typeof e=="object"&&!Array.isArray(e)){let i=e.monthly;if(typeof i=="number")return i}let n=t.pricing;if(n&&typeof n=="object"&&!Array.isArray(n)){let i=n.monthlyPriceCents;if(typeof i=="number")return i}return 0}function hE(t){let e=t.credits;if(!e||typeof e!="object"||Array.isArray(e))return 0;let n=e.monthlyIncludedMicros;return typeof n=="number"?n:0}function vE(t,e){let n=t.find(i=>i.meter===e||i.dimension===e);return typeof n?.capacity=="number"?n.capacity:void 0}function P$(t){let[e,n,i,r]=t.split(":");if(!e||!n||!i)throw new Error("Limit must be meter:window:capacity[:enforce|track]");return{
|
|
401
|
+
`).action(async(i,r)=>{let o=e(),a=await Z(t,o,r.product,r.env),s=await re(o,a.productId,a.env);Zr(s,"plan_removed",r),s.plans=ui(s).filter(c=>c.key!==i),await ve(t,o,a.productId,s,{dryRun:r.dryRun,env:a.env,message:`Plan "${i}" removed`})})}function dE(t,e,n){let i=e.free?0:e.priceMonthly??0,r=fE(n,e.free,e.meter.length>0),o={key:t,name:e.name??bE(t),free:e.free===!0,price:{monthly:i,currency:"USD"},pricing:{model:r,monthlyPriceCents:i,billingInterval:"month"},usage:{meters:e.meter},features:e.feature,limits:e.limit.map(P$)};return e.creditsMonthlyMicros!==void 0&&(o.credits={monthlyIncludedMicros:e.creditsMonthlyMicros}),o}function fE(t,e,n){let i=mE(t);return(e||n)&&i.includes("included_usage")?"included_usage":!n&&i.includes("flat_rate")?"flat_rate":i.includes("included_usage")?"included_usage":i.includes("pay_as_you_go")?"pay_as_you_go":i.includes("configurable_usage")?"configurable_usage":"flat_rate"}function mE(t){let n=G_(t);if(n&&n.length>0)return n;switch(t){case"free_trial":case"flat_subscription":return["flat_rate"];case"included_usage":case"subscription_overage":case"prepaid_credits":return["included_usage","configurable_usage"];case"pay_as_you_go":return["pay_as_you_go","configurable_usage"];default:return["flat_rate"]}}function pE(t){let e=t.billing;if(typeof e=="object"&&e!==null&&!Array.isArray(e)){let n=e.strategy;if(typeof n=="string")return n}return"flat_subscription"}async function pi(t,e,n,i,r,o,a){let s=await Z(t,e,n,i),c=await re(e,s.productId,s.env);a(li(c,r),c),await ve(t,e,s.productId,c,{dryRun:o,env:s.env,message:`Plan "${r}" updated`})}function Zr(t,e,n){!e||!n.existingSubscribers||zp(t,e,b$(n.existingSubscribers),{ackPriceIncrease:n.ackPriceIncrease,ackEntitlementReduction:n.ackEntitlementReduction})}function gE(t){let e=t.price;if(e&&typeof e=="object"&&!Array.isArray(e)){let i=e.monthly;if(typeof i=="number")return i}let n=t.pricing;if(n&&typeof n=="object"&&!Array.isArray(n)){let i=n.monthlyPriceCents;if(typeof i=="number")return i}return 0}function hE(t){let e=t.credits;if(!e||typeof e!="object"||Array.isArray(e))return 0;let n=e.monthlyIncludedMicros;return typeof n=="number"?n:0}function vE(t,e){let n=t.find(i=>i.meter===e||i.dimension===e);return typeof n?.capacity=="number"?n.capacity:void 0}function P$(t){let[e,n,i,r]=t.split(":");if(!e||!n||!i)throw new Error("Limit must be meter:window:capacity[:enforce|track]");return{dimension:e,window:{type:"named",name:n},capacity:Number(i),enforcement:r??"enforce"}}function yE(t){return typeof t.dimension=="string"?t.dimension:typeof t.meter=="string"?t.meter:""}function jp(t,e){return e.push(t),e}function ms(t){let e=Number.parseInt(t,10);if(!Number.isFinite(e))throw new Error(`Invalid integer: ${t}`);return e}function bE(t){return t.split(/[-_]/).filter(Boolean).map(e=>e.slice(0,1).toUpperCase()+e.slice(1)).join(" ")}function A$(t,e){let n=t.command("product").description("Manage products and inspect the latest accepted internal product config").addHelpText("after",`
|
|
402
402
|
Agent notes:
|
|
403
403
|
Product commands use core APIs, not local files. After product create, the product is selected in ~/.farthershore/config.json.
|
|
404
404
|
GitHub default-branch edits publish proposals. CLI, MCP, and UI commands stage a shared server draft until apply publishes it.
|