@farthershore/cli 0.9.0 → 0.9.1
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
|
@@ -138,7 +138,7 @@ Examples:
|
|
|
138
138
|
farthershore build --validate weather-api --format json
|
|
139
139
|
farthershore build --validate weather-api --env preview --format json
|
|
140
140
|
`).action(async o=>{let e=t.opts(),i=Pe(e.format),a=o.entry??g$,s=o.out??h$,u=n.runLocalManifestBuild??y$,l=n.readManifestEnvelope??b$,d=await u({entry:a,out:s});if($$(d,i),d.exitCode!==0){x$(d,a,s,i);return}let p;try{p=await l(s)}catch(_){k$(_,a,s,i);return}let g=null;if(o.validate)try{g=await w$({client:r(),product:o.validate,ir:p.ir,envName:o.env??e.env})}catch(_){S$(_,a,s,p,i);return}I$({entry:a,out:s,envelope:p,validation:g,format:i})})}function $$(t,r){r!=="json"&&(t.stdout&&process.stdout.write(t.stdout),t.stderr&&process.stderr.write(t.stderr))}function x$(t,r,n,o){if(process.exitCode=t.exitCode||1,o==="json"){console.log(ae({ok:!1,success:!1,phase:"local_build",entry:r,out:n,command:t.command,args:t.args,exitCode:t.exitCode,signal:t.signal,stdout:t.stdout,stderr:t.stderr,nextActions:["Fix product/product.config.ts and run farthershore build again"]}));return}Ve(`Manifest build failed with exit code ${t.exitCode||1}`)}function k$(t,r,n,o){let e=t instanceof Error?t.message:"Manifest IR output could not be read";if(process.exitCode=1,o==="json"){console.log(ae({ok:!1,success:!1,phase:"read_manifest_ir",entry:r,out:n,errors:[{message:e}],nextActions:["Check the manifest build output path and run farthershore build again"]}));return}Ve(e)}function S$(t,r,n,o,e){let i=t instanceof Error?t.message:"Manifest compile dry-run failed";if(process.exitCode=1,e==="json"){console.log(ae({ok:!1,success:!1,phase:"remote_validation",entry:r,out:n,irHash:o.irHash??null,errors:[{message:i}],nextActions:["Fix product/product.config.ts or credentials and run farthershore build --validate again"]}));return}Ve(i)}async function w$(t){let r=await N(t.client,t.product),n=dd(t.envName),o=md(n);return t.client.compileProductManifest(r,{ir:t.ir,env:o})}function I$(t){let r=t.validation?.success!==!1;if(r||(process.exitCode=1),t.format==="json"){console.log(ae({ok:r,success:r,entry:t.entry,out:t.out,irHash:t.envelope.irHash??t.validation?.irHash??null,validation:t.validation,errors:t.validation?.errors??[],warnings:t.validation?.warnings??[],lifecyclePlan:t.validation?.lifecyclePlan??null,nextActions:z$(r,t.validation)}));return}if(ke(`Manifest IR written to ${t.out}`),!t.validation){Oe("Run farthershore build --validate <product> to dry-run compile against core.");return}if(r){ke("Manifest compile dry-run passed");for(let n of t.validation.warnings??[])oo(Zg(n));O$(t.validation.lifecyclePlan),P$(t.validation.compiledPlans);return}Ve(`Manifest compile dry-run failed
|
|
141
|
-
`);for(let n of t.validation.errors??[])console.log(` - ${Zg(n)}`)}function z$(t,r){return r?t?["Commit product/product.config.ts and the generated Manifest IR if desired"]:["Fix product/product.config.ts and run farthershore build --validate again"]:["Run farthershore build --validate <product> to dry-run compile"]}function Zg(t){let r=t.code?`[${t.code}] `:"",n=t.path?`${t.path}: `:"";return`${r}${n}${t.message}`}function O$(t){if(t){if(t.requiresSubscriptionMigration){oo(`Subscription migration required (${t.actions.length} domain action(s)). See lifecyclePlan in --format json output for details.`);return}t.actions.length>0&&Oe(`Lifecycle plan: ${t.actions.length} domain action(s); no subscription migration required.`)}}function P$(t){if(t?.length){Oe("Compiled plan active subscriptions:");for(let r of t){let n=r.planKey??"(unknown)",o=r.status?` ${r.status}`:"",e=r.activeSubscriptionCount??0;Oe(` - ${n}:${o} ${e}`)}}}function E$(t){return!!t&&typeof t=="object"&&!Array.isArray(t)}var T$={UNAUTHORIZED:"Token is invalid or revoked. Run `farthershore auth login` to update it.",FORBIDDEN:"Your token doesn't have access to this resource. Check the org / product scope.",INVALID_ACCESS_KEY:"Token format is wrong. Generate a new one at https://farthershore.com/settings/tokens.",MAKER_TOKEN_REVOKED:"This maker token was revoked. Mint a new one in the product settings.",MAKER_TOKEN_NO_PRODUCT:"Maker token is not bound to a product. Re-create it from the product page.",AUTH_NO_TOKEN:"Pass --token <mk_...> or set FARTHERSHORE_TOKEN, or run interactively in a TTY.",AUTH_INVALID_TOKEN:"Token format is malformed. Maker tokens start with `mk_` and are 30+ characters.",DESTRUCTIVE_OP_REQUIRES_YES:"Destructive ops (delete) require an explicit `--yes` to proceed. This is intentional safety.",PRODUCT_UPDATE_NO_FIELDS:"Pass at least one field flag (--display-name, --base-url, --description).",PLAN_UPDATE_NO_FIELDS:"Pass at least one of --name, --recurring-fee-cents, --recurring-credit-grant-cents, --one-time-credit-grant-cents, --trial-days, --max-monthly-spend-cents.",ENV_NOT_FOUND:"Environment doesn't exist. Use `farthershore env list <product>` to see available envs, or create one with `farthershore env create`.",STRIPE_NOT_CONFIGURED:"Stripe isn't connected on this product. Connect it in the dashboard before running billing operations.",STRIPE_NOT_CONNECTED:"Publishing requires a connected Stripe account. Connect one on the dashboard Connections page, then re-run `farthershore product publish`.",STRIPE_NOT_VERIFIED:"Your Stripe account isn't fully verified yet. Finish Stripe onboarding, then re-run `farthershore product publish`.",BILLING_TAX_NOT_ENROLLED:"Stripe Tax isn't enrolled for this account. Enable it from the dashboard Connections page, then re-run `farthershore product publish`.",STRIPE_BALANCE_OUTSTANDING:"Customer has an outstanding balance. Resolve the invoice in Stripe before retrying.",CHECKOUT_SESSION_FAILED:"Stripe rejected the checkout request. Check that the plan exists and Stripe credentials are valid.",PRODUCT_NOT_FOUND:"Check the product slug. Run `farthershore` (no args) for a list of products you can see.",PRODUCT_REPO_NOT_LINKED:"Link a GitHub repo to this product before publishing or validating product manifests.",YAML_PARSE_ERROR:"product manifest is not valid. Run `farthershore build --validate <product>` to surface validation details.",GITHUB_NOT_CONNECTED:"Connect GitHub on the org page before running `init` (it provisions the repo).",BRANCH_NO_MATCHING_ENV:"The current branch isn't mapped to an environment. Add a branch rule in product settings or pass --branch explicitly.",PLAN_NOT_FOUND:"Plan key doesn't exist on this product. Check the `plans` block in your local product manifest.",PLAN_HAS_ACTIVE_SUBSCRIPTIONS:"Plan has active subscribers and can't be deleted. Migrate them to another plan first.",PLAN_SLUG_CONFLICT:"Another plan already uses this key. Pick a unique plan key in your manifest.",SLUG_CONFLICT:"This product slug is taken. Pick a different name.",SLUG_BLOCKED:"This slug is reserved or blocked. Pick a different name.",SLUG_RESERVED:"This slug is reserved by Farther Shore. Pick a different name.",SLUG_INVALID_FORMAT:"Slug must be lowercase letters, digits, and hyphens (no leading/trailing hyphen).",DECISION_NOT_FOUND:"No DenialEvent recorded for that decisionId. Verify the id from the original deny response or audit log.",AUTH_UNAUTHORIZED:"Token is missing, expired, or lacks the audit:read scope required to read denial events.",RATE_LIMIT_EXCEEDED:"You've hit the rate limit. Wait a moment and retry.",VALIDATION_ERROR:"Request is malformed. The `details` field has the field-level errors.",CONFLICT:"The resource is in a state that conflicts with the request. Inspect `details` to learn more."};function Mg(t){if(t)return T$[t]}var D$=C$(A$(import.meta.url)),U$=JSON.parse(await j$(N$(D$,"..","package.json"),"utf-8")),q=new Ml;q.name("farthershore").description("FartherShore CLI \u2014 agent-friendly commands for product configuration").version(U$.version).option("--token <token>","Override auth token").option("--api-url <url>","Override API base URL").option("--
|
|
141
|
+
`);for(let n of t.validation.errors??[])console.log(` - ${Zg(n)}`)}function z$(t,r){return r?t?["Commit product/product.config.ts and the generated Manifest IR if desired"]:["Fix product/product.config.ts and run farthershore build --validate again"]:["Run farthershore build --validate <product> to dry-run compile"]}function Zg(t){let r=t.code?`[${t.code}] `:"",n=t.path?`${t.path}: `:"";return`${r}${n}${t.message}`}function O$(t){if(t){if(t.requiresSubscriptionMigration){oo(`Subscription migration required (${t.actions.length} domain action(s)). See lifecyclePlan in --format json output for details.`);return}t.actions.length>0&&Oe(`Lifecycle plan: ${t.actions.length} domain action(s); no subscription migration required.`)}}function P$(t){if(t?.length){Oe("Compiled plan active subscriptions:");for(let r of t){let n=r.planKey??"(unknown)",o=r.status?` ${r.status}`:"",e=r.activeSubscriptionCount??0;Oe(` - ${n}:${o} ${e}`)}}}function E$(t){return!!t&&typeof t=="object"&&!Array.isArray(t)}var T$={UNAUTHORIZED:"Token is invalid or revoked. Run `farthershore auth login` to update it.",FORBIDDEN:"Your token doesn't have access to this resource. Check the org / product scope.",INVALID_ACCESS_KEY:"Token format is wrong. Generate a new one at https://farthershore.com/settings/tokens.",MAKER_TOKEN_REVOKED:"This maker token was revoked. Mint a new one in the product settings.",MAKER_TOKEN_NO_PRODUCT:"Maker token is not bound to a product. Re-create it from the product page.",AUTH_NO_TOKEN:"Pass --token <mk_...> or set FARTHERSHORE_TOKEN, or run interactively in a TTY.",AUTH_INVALID_TOKEN:"Token format is malformed. Maker tokens start with `mk_` and are 30+ characters.",DESTRUCTIVE_OP_REQUIRES_YES:"Destructive ops (delete) require an explicit `--yes` to proceed. This is intentional safety.",PRODUCT_UPDATE_NO_FIELDS:"Pass at least one field flag (--display-name, --base-url, --description).",PLAN_UPDATE_NO_FIELDS:"Pass at least one of --name, --recurring-fee-cents, --recurring-credit-grant-cents, --one-time-credit-grant-cents, --trial-days, --max-monthly-spend-cents.",ENV_NOT_FOUND:"Environment doesn't exist. Use `farthershore env list <product>` to see available envs, or create one with `farthershore env create`.",STRIPE_NOT_CONFIGURED:"Stripe isn't connected on this product. Connect it in the dashboard before running billing operations.",STRIPE_NOT_CONNECTED:"Publishing requires a connected Stripe account. Connect one on the dashboard Connections page, then re-run `farthershore product publish`.",STRIPE_NOT_VERIFIED:"Your Stripe account isn't fully verified yet. Finish Stripe onboarding, then re-run `farthershore product publish`.",BILLING_TAX_NOT_ENROLLED:"Stripe Tax isn't enrolled for this account. Enable it from the dashboard Connections page, then re-run `farthershore product publish`.",STRIPE_BALANCE_OUTSTANDING:"Customer has an outstanding balance. Resolve the invoice in Stripe before retrying.",CHECKOUT_SESSION_FAILED:"Stripe rejected the checkout request. Check that the plan exists and Stripe credentials are valid.",PRODUCT_NOT_FOUND:"Check the product slug. Run `farthershore` (no args) for a list of products you can see.",PRODUCT_REPO_NOT_LINKED:"Link a GitHub repo to this product before publishing or validating product manifests.",YAML_PARSE_ERROR:"product manifest is not valid. Run `farthershore build --validate <product>` to surface validation details.",GITHUB_NOT_CONNECTED:"Connect GitHub on the org page before running `init` (it provisions the repo).",BRANCH_NO_MATCHING_ENV:"The current branch isn't mapped to an environment. Add a branch rule in product settings or pass --branch explicitly.",PLAN_NOT_FOUND:"Plan key doesn't exist on this product. Check the `plans` block in your local product manifest.",PLAN_HAS_ACTIVE_SUBSCRIPTIONS:"Plan has active subscribers and can't be deleted. Migrate them to another plan first.",PLAN_SLUG_CONFLICT:"Another plan already uses this key. Pick a unique plan key in your manifest.",SLUG_CONFLICT:"This product slug is taken. Pick a different name.",SLUG_BLOCKED:"This slug is reserved or blocked. Pick a different name.",SLUG_RESERVED:"This slug is reserved by Farther Shore. Pick a different name.",SLUG_INVALID_FORMAT:"Slug must be lowercase letters, digits, and hyphens (no leading/trailing hyphen).",DECISION_NOT_FOUND:"No DenialEvent recorded for that decisionId. Verify the id from the original deny response or audit log.",AUTH_UNAUTHORIZED:"Token is missing, expired, or lacks the audit:read scope required to read denial events.",RATE_LIMIT_EXCEEDED:"You've hit the rate limit. Wait a moment and retry.",VALIDATION_ERROR:"Request is malformed. The `details` field has the field-level errors.",CONFLICT:"The resource is in a state that conflicts with the request. Inspect `details` to learn more."};function Mg(t){if(t)return T$[t]}var D$=C$(A$(import.meta.url)),U$=JSON.parse(await j$(N$(D$,"..","package.json"),"utf-8")),q=new Ml;q.name("farthershore").description("FartherShore CLI \u2014 agent-friendly commands for product configuration").version(U$.version).option("--token <token>","Override auth token").option("--api-url <url>","Override API base URL").option("--format <format>","Output format. Use --format json for machine-readable agent output");function ze(){let t=ql(),r=q.opts(),n=Xl(r.token),o=r.apiUrl??process.env.FARTHERSHORE_API_URL??t.apiUrl;return Vl({apiUrl:o,token:n})}pd(q,ze);hd(q,ze);vd(q,ze);zg(q,ze);Og(q,ze);Pg(q,ze);Eg(q,ze);Tg(q,ze);Cg(q);Fg(q,ze);Ug(q);q.exitOverride();function R$(t){let r=t.code?` [${t.code}]`:"";process.stderr.write(`Error${r}: ${t.message}
|
|
142
142
|
`);let n=Mg(t.code);n&&process.stderr.write(`Hint: ${n}
|
|
143
143
|
`)}async function Z$(){try{await q.parseAsync(process.argv)}catch(t){if(t instanceof S)R$(t),process.exitCode=1;else if(t instanceof Error){let r=t.code;r==="commander.helpDisplayed"||r==="commander.version"||t.message!=="(outputHelp)"&&(process.stderr.write(`Error: ${t.message}
|
|
144
144
|
`),process.exitCode=1)}}}Z$();
|