Skip to content

forcedotcom/sf-skills / plugins/builder/consumer-goods/skills/consumer-goods-tpe-dashboard-configure

consumer-goods-tpe-dashboard-configure

Verified

End-to-end headless setup of Trade Promotion Effectiveness (TPE) dashboards for a Trade Promotion Management (TPM) Cloud org, covering tenant pairing checks, permission sets, SSOT and Tableau Next enablement, C360 SDM verification, the TPM Accruals data kit install, business-period export, RTR Data Cloud export configuration, the TPM_PROMOTION_MEASURE Data Transform, TPE Analytics app install, and optional KPI dashboard customization. Use when a customer or admin wants to set up TPE dashboards, enable Trade Promotion Effectiveness, install the TPE analytics app, or set up and customize TPE dashboards with their own KPIs.

FileKindSize
SKILL.mdskill md5.7 KB
references/phases-1-6.mdmarkdown9.3 KB
references/phases-7-12.mdmarkdown21.4 KB
scripts/find-failure-reason.jsexecutablescript4.8 KB
scripts/poll-status.jsexecutablescript3.5 KB
scripts/render-apex.jsexecutablescript2.0 KB
scripts/run-data-transform.jsexecutablescript4.2 KB
scripts/schedule-business-period-export.apexother1.7 KB
scripts/sf-rest.jsexecutablescript5.7 KB
scripts/soql-escape.jsexecutablescript755 B

scripts/render-apex.js

View on GitHub
#!/usr/bin/env node
/**
 * Render one of this skill's `scripts/*.apex` templates by substituting
 * `%TOKEN%` placeholders, writing the result to a temp file, and printing
 * that file's path on stdout (so a caller can pipe it straight into
 * `sf apex run -f <path>`).
 *
 * Usage:
 *   node render-apex.js <template-path> --var NS_FIELD=cgcloud_dev__ --var NS_APEX=cgcloud_dev.
 *
 * Every `%TOKEN%` in the template must have a matching --var — this script
 * fails loudly on any leftover `%TOKEN%` after substitution rather than
 * silently sending unrendered Apex to the org.
 *
 * Every --var value is escaped (see soql-escape.js) before substitution, so
 * callers must pass raw values — never pre-escape a value before handing it
 * to this script, that would double-escape it.
 */

const fs = require('fs');
const os = require('os');
const path = require('path');
const { escapeSoqlLiteral } = require('./soql-escape');

function parseArgs(argv) {
  const templatePath = argv[0];
  const vars = {};
  for (let i = 1; i < argv.length; i += 1) {
    if (argv[i] !== '--var') continue;
    const pair = argv[i + 1];
    const eq = pair.indexOf('=');
    vars[pair.slice(0, eq)] = pair.slice(eq + 1);
    i += 1;
  }
  return { templatePath, vars };
}

function main() {
  const { templatePath, vars } = parseArgs(process.argv.slice(2));
  if (!templatePath) {
    console.error('Missing required <template-path>');
    process.exit(2);
  }

  let rendered = fs.readFileSync(templatePath, 'utf8');
  for (const [key, value] of Object.entries(vars)) {
    rendered = rendered.split(`%${key}%`).join(escapeSoqlLiteral(value));
  }

  const leftover = rendered.match(/%[A-Z_]+%/g);
  if (leftover) {
    console.error(`render-apex: unresolved placeholder(s): ${leftover.join(', ')}`);
    process.exit(2);
  }

  const outPath = path.join(
    os.tmpdir(),
    `tpe-dashboard-${path.basename(templatePath, '.apex')}-${process.pid}.apex`
  );
  fs.writeFileSync(outPath, rendered, 'utf8');
  console.log(outPath);
}

main();
deprecation-and-migrationaddyosmani/agent-skillsManages deprecation and migration. Use when removing old systems, APIs, or features. Use when migrating users from one implementation to another. Use when migrating a database schema in production, such as renaming or dropping a column without downtime (expand/contract). Use when deciding whether to maintain or sunset existing code.Stars: 119kUpdated Claude CodeCodexVerifiedInstall
performance-optimizationaddyosmani/agent-skillsOptimizes application performance across frontend, backend, queries, and databases. Use when performance requirements exist, when you suspect performance regressions, when Core Web Vitals or load times need improvement, when N+1 query patterns need fixing, or when profiling reveals bottlenecks.Stars: 119kUpdated Claude CodeCodexVerifiedInstall
agent-cost-reportthedotmack/claude-memBelievable agent cost report for any period, default the last 7 full days PT, not counting today. Measured tokens from Claude Code transcripts priced at OpenRouter list prices (ESTIMATED), measured provider spend when a sanctioned source exists, note-taker cost separate, Timing-style HTML/PDF plus report.json, line-items.csv, evidence.json.Stars: 118kUpdated Claude CodeCodexVerifiedInstall
agent-cost-reportthedotmack/claude-memBelievable agent cost report for any period, default the last 7 full days PT, not counting today. Measured tokens from Claude Code transcripts priced at OpenRouter list prices (ESTIMATED), measured provider spend when a sanctioned source exists, note-taker cost separate, Timing-style HTML/PDF plus report.json, line-items.csv, evidence.json.Stars: 118kUpdated Claude CodeCodexVerifiedInstall