Skip to content

microsoft/power-platform-skills / plugins/power-pages/skills/create-site

create-site

Verified

Creates a new Power Pages site from an SPA or non-SPA template, or scaffolds an SPA from scratch using React, Angular, Vue, or Astro. Guides requirements discovery, template selection, provisioning, design, validation, and deployment. Use when the user wants to create, build, use a template for, or scaffold a new Power Pages website or portal.

FileKindSize
SKILL.mdskill md155.6 KB
assets/angular/angular.jsonconfig1.6 KB
assets/angular/gitignoreother484 B
assets/angular/package.jsonmanifest743 B
assets/angular/powerpages.config.jsonconfig187 B
assets/angular/public/.gitkeepother0 B
assets/angular/src/app/app.component.tsscript365 B
assets/angular/src/app/app.config.tsscript319 B
assets/angular/src/app/app.routes.tsscript278 B
assets/angular/src/app/components/layout.component.tsscript167 B
assets/angular/src/app/pages/about.component.tsscript151 B
assets/angular/src/app/pages/home.component.tsscript24.0 KB
assets/angular/src/index.htmlother703 B
assets/angular/src/main.tsscript208 B
assets/angular/src/styles.cssother333 B
assets/angular/tsconfig.app.jsonconfig153 B
assets/angular/tsconfig.jsonconfig542 B
assets/astro/astro.config.mjsscript139 B
assets/astro/gitignoreother358 B
assets/astro/package.jsonmanifest285 B
assets/astro/powerpages.config.jsonconfig264 B
assets/astro/public/.gitkeepother0 B
assets/astro/src/components/Footer.astroother70 B
assets/astro/src/components/Header.astroother70 B
assets/astro/src/layouts/Layout.astroother946 B
assets/astro/src/pages/about.astroother87 B
assets/astro/src/pages/index.astroother22.6 KB
assets/astro/src/styles/theme.cssother333 B
assets/astro/tsconfig.jsonconfig42 B
assets/create-site-plan.htmlother30.2 KB
assets/non-spa-creation-status-template.htmlother35.0 KB
assets/react/gitignoreother419 B
assets/react/index.htmlother759 B
assets/react/package.jsonmanifest488 B
assets/react/powerpages.config.jsonconfig165 B
assets/react/src/App.tsxother362 B
assets/react/src/components/Layout.tsxother139 B
assets/react/src/main.tsxother325 B
assets/react/src/pages/About.tsxother50 B
assets/react/src/pages/Home.tsxother23.9 KB
assets/react/src/styles/theme.cssother333 B
assets/react/tsconfig.jsonconfig509 B
assets/react/vite.config.tsscript169 B
assets/shared/power-pages-icon.pngbinary22.2 KB
assets/template-browser.htmlother6.5 KB
assets/vue/env.d.tsscript186 B
assets/vue/gitignoreother419 B
assets/vue/index.htmlother757 B
assets/vue/package.jsonmanifest412 B
assets/vue/powerpages.config.jsonconfig165 B
assets/vue/src/App.vueother146 B
assets/vue/src/components/Layout.vueother34 B
assets/vue/src/main.tsscript160 B
assets/vue/src/pages/About.vueother37 B
assets/vue/src/pages/Home.vueother23.2 KB
assets/vue/src/router/index.tsscript319 B
assets/vue/src/styles/theme.cssother333 B
assets/vue/tsconfig.jsonconfig560 B
assets/vue/vite.config.tsscript163 B
references/design-aesthetics.mdmarkdown617 B
scripts/list-site-templates.jsscript4.6 KB
scripts/render-non-spa-status.jsscript14.0 KB
scripts/resolve-non-spa-context.jsscript5.6 KB
scripts/validate-site.jsscript15.7 KB
workflows/non-spa-site.mdmarkdown36.3 KB

scripts/render-non-spa-status.js

View on GitHub
#!/usr/bin/env node

const fs = require('fs');
const os = require('os');
const path = require('path');
const { pathToFileURL } = require('url');
const {
  renderTemplate,
  parseArgs,
} = require('../../../scripts/lib/render-template');
const {
  normalizeNonSpaModelVersion,
} = require('../../../scripts/lib/site-templates');
const {
  loadNonSpaTemplatePresentation,
} = require('../../../scripts/lib/non-spa-template-catalog');
const {
  CLOUD_TO_SITE_DOMAIN,
} = require('../../../scripts/lib/validation-helpers');

const ACTIVITY_STATES = new Set(['working', 'awaiting-input', 'failed', 'canceled']);

const STATUSES = Object.freeze({
  accepted: {
    step: 0,
    chip: 'Request accepted',
    title: 'Creation request accepted',
    message:
      'Power Pages accepted the request. No action is required while the platform prepares the site.',
  },
  provisioning: {
    step: 1,
    chip: 'Provisioning',
    title: 'Provisioning the selected template',
    message: 'The asynchronous creation operation is assembling the platform-managed components.',
  },
  registration: {
    step: 2,
    chip: 'Registering',
    title: 'Waiting for the website record',
    message: 'Provisioning completed. The website is still propagating to Dataverse and PAC.',
  },
  verification: {
    step: 3,
    chip: 'Verifying',
    title: 'Verifying the selected data model',
    message: 'The website record is available. PAC is confirming that the expected model was created.',
  },
  download: {
    step: 4,
    chip: 'Downloading',
    title: 'Downloading your site',
    message: 'The site is ready for PAC. Its non-SPA pages, forms, navigation, and settings are downloading.',
  },
  validation: {
    step: 5,
    chip: 'Validating',
    title: 'Validating the downloaded baseline',
    message: 'The downloaded identity, non-SPA assets, and project structure are being checked.',
  },
  git: {
    step: 5,
    chip: 'Saving baseline',
    title: 'Saving a clean starting point',
    message: 'The validated template is being recorded as the initial Git baseline.',
  },
  ready: {
    step: 6,
    chip: 'Ready',
    title: 'Your site is ready',
    message: 'The downloaded baseline and cloud site are ready for customization.',
    terminal: true,
    result: {
      title: 'Creation complete',
      message: 'Data model verified · Site downloaded · Validation passed · Git baseline created',
    },
  },
  'model-mismatch': {
    step: 3,
    chip: 'Action required',
    title: 'The site was created with a different data model',
    message: 'PAC reports a different model than selected. The cloud site is preserved, but download stopped to prevent using the wrong model.',
    terminal: true,
    error: true,
    result: {
      title: 'No duplicate site will be created',
      message: 'Review the environment setting, keep the existing website record, and resume verification later.',
    },
  },
});

const TIMELINE = Object.freeze([
  ['Request accepted', 'The platform returned 202 Accepted'],
  ['Template provisioning', 'The asynchronous operation is running'],
  ['Website registration', 'Waiting for the service-assigned website ID'],
  ['Data model verification', 'Checking the site with PAC'],
  ['Template download', 'Downloading non-SPA site assets'],
  ['Local validation', 'Checking identity, assets, and project structure; saving the Git baseline'],
]);

function toDataUrl(filePath) {
  const extension = path.extname(filePath).toLowerCase();
  const mimeType = extension === '.png' ? 'image/png' : 'application/octet-stream';
  return `data:${mimeType};base64,${fs.readFileSync(filePath).toString('base64')}`;
}

function validateWebsiteUrl(value) {
  let url;
  try {
    url = new URL(value);
  } catch {
    throw new Error('--siteUrl must be a valid absolute URL');
  }
  if (url.protocol !== 'https:' || url.username || url.password) {
    throw new Error('--siteUrl must use HTTPS without embedded credentials');
  }
  return url.href;
}

function validatePlainTextOption(name, value, options = {}) {
  const text = String(value || '').trim();
  if (options.required && !text) {
    throw new Error(`${name} is required`);
  }
  if (!text) return '';
  if (/[\u0000-\u001f\u007f]/.test(text)) {
    throw new Error(`${name} must be plain single-line text`);
  }
  const maxLength = options.maxLength || 500;
  if (text.length > maxLength) {
    throw new Error(`${name} must be ${maxLength} characters or fewer`);
  }
  return text;
}

function buildModel(options, template) {
  const modelVersion = normalizeNonSpaModelVersion(options.modelVersion);
  const actualModelVersion = options.actualModelVersion
    ? normalizeNonSpaModelVersion(options.actualModelVersion)
    : null;
  if (!template || template.name !== options.templateName) {
    throw new Error(`Catalog metadata does not match --templateName: ${options.templateName}`);
  }

  const status = STATUSES[options.status];
  if (!status) {
    throw new Error(`Unsupported --status: ${options.status}`);
  }
  const siteDomain = CLOUD_TO_SITE_DOMAIN[options.cloud];
  if (!siteDomain) {
    throw new Error(
      `Unsupported --cloud: ${options.cloud}. Use ${Object.keys(CLOUD_TO_SITE_DOMAIN).join(', ')}.`,
    );
  }
  const explicitSiteUrl = options.siteUrl ? validateWebsiteUrl(options.siteUrl) : null;
  if (options.status === 'ready' && !explicitSiteUrl) {
    throw new Error('--siteUrl is required when --status is ready');
  }
  if (!Number.isInteger(Number(options.language)) || Number(options.language) <= 0) {
    throw new Error('--language must be a positive integer LCID');
  }
  const resolvedStatus = {
    ...status,
    message:
      options.status === 'model-mismatch'
        ? `PAC reports ${actualModelVersion || 'a different model'} instead of ` +
          `${modelVersion}. The cloud site is preserved, but download stopped to prevent using ` +
          'the wrong model.'
        : status.message,
    result: status.result
      ? {
          ...status.result,
          message:
            options.status === 'ready'
              ? `${modelVersion} model verified · Site downloaded · Validation passed · ` +
                'Git baseline created'
              : status.result.message,
        }
      : undefined,
  };
  const defaultActivityState =
    options.status === 'ready' ? 'complete' : status.error ? 'failed' : 'working';
  const activityState = options.activityState || defaultActivityState;
  if (
    activityState !== 'complete' &&
    !ACTIVITY_STATES.has(activityState)
  ) {
    throw new Error(
      `Unsupported --activityState: ${activityState}. ` +
        'Use working, awaiting-input, failed, or canceled.',
    );
  }
  if (activityState === 'complete' && options.activityState) {
    throw new Error('--activityState complete is derived from --status ready and cannot be set directly');
  }
  if (status.terminal && activityState === 'working') {
    throw new Error(`--status ${options.status} cannot use --activityState working`);
  }
  if (
    options.status === 'ready' &&
    (activityState === 'failed' || activityState === 'canceled')
  ) {
    throw new Error(
      `--status ready cannot use --activityState ${activityState}; ` +
        'the completed site remains ready when optional follow-up work stops.',
    );
  }
  if (activityState === 'awaiting-input' && !String(options.requiredAction || '').trim()) {
    throw new Error('--requiredAction is required when --activityState is awaiting-input');
  }
  if (
    activityState !== 'awaiting-input' &&
    (options.requiredAction || options.responseLocation)
  ) {
    throw new Error(
      '--requiredAction and --responseLocation are only valid with --activityState awaiting-input',
    );
  }

  const awaitingInput = activityState === 'awaiting-input';
  const failed = activityState === 'failed';
  const canceled = activityState === 'canceled';
  const genericTerminalActivity =
    (failed || canceled) && options.status !== 'model-mismatch';
  const terminalReason = validatePlainTextOption(
    '--terminalReason',
    options.terminalReason,
    { required: genericTerminalActivity, maxLength: 500 },
  );
  const nextAction = validatePlainTextOption(
    '--nextAction',
    options.nextAction,
    { required: genericTerminalActivity, maxLength: 300 },
  );
  if (!genericTerminalActivity && (terminalReason || nextAction)) {
    throw new Error(
      '--terminalReason and --nextAction are only valid with a generic failed or canceled activity',
    );
  }
  if (genericTerminalActivity) {
    resolvedStatus.result = {
      title: failed ? 'Creation stopped' : 'Creation canceled',
      message: terminalReason,
      nextAction,
    };
    resolvedStatus.message = terminalReason;
    resolvedStatus.error = failed;
  } else if (options.status === 'model-mismatch') {
    resolvedStatus.result = {
      ...resolvedStatus.result,
      nextAction:
        'Confirm the environment data-model setting, then resume verification of this existing site.',
    };
  }
  const terminal = !awaitingInput && (status.terminal || failed || canceled);
  const activityChip = awaitingInput
    ? 'Input needed'
    : failed
      ? 'Creation stopped'
      : canceled
        ? 'Canceled'
        : resolvedStatus.chip;

  const pluginRoot = path.resolve(__dirname, '..', '..', '..');
  const brandIcon = toDataUrl(
    path.join(pluginRoot, 'skills', 'create-site', 'assets', 'shared', 'power-pages-icon.png'),
  );
  return {
    brandIcon,
    template: {
      name: template.name,
      displayName: template.displayName,
      description: template.description,
      capabilities: template.capabilities || [],
      requirements: template.requirements || [],
      warning: template.warning || '',
      previews: template.previews || [],
      catalog: template.catalog,
    },
    site: {
      name: options.siteName,
      url: explicitSiteUrl || `https://${options.subdomain}.${siteDomain}`,
      language: {
        source: 'Organization default',
        name: validatePlainTextOption('--languageName', options.languageName, {
          required: true,
          maxLength: 100,
        }),
        code: validatePlainTextOption('--languageCode', options.languageCode, {
          maxLength: 35,
        }),
        lcid: String(options.language),
      },
      websiteRecordId: options.websiteRecordId || '',
      modelVersion,
    },
    status: {
      key: options.status,
      ...resolvedStatus,
      chip: activityChip,
      activityState,
      terminal,
      openWebsiteUrl: options.status === 'ready' ? explicitSiteUrl : null,
      footer:
        options.status === 'model-mismatch'
          ? 'The cloud site is preserved. Resolve the data-model setting before resuming verification and download.'
          : failed
          ? 'Creation stopped before a usable local baseline was ready. Follow the next action above before retrying.'
          : canceled
            ? 'Creation was canceled. Any cloud resource or local files already created are preserved.'
            : options.status === 'ready' && !awaitingInput
                ? 'Creation is complete. You can keep this page open while you begin customizing the downloaded site.'
                : null,
      notification: awaitingInput
        ? {
            title: 'Your input is needed',
            requiredAction: String(options.requiredAction).trim(),
            responseLocation:
              String(options.responseLocation || '').trim() ||
              'Return to the site creation conversation and provide your response.',
          }
        : null,
    },
    timeline: TIMELINE,
    refresh: !terminal,
  };
}

async function renderStatusPage(options, deps = {}) {
  if (
    !options.templateName ||
    !options.catalogOwner ||
    !options.catalogRepo ||
    !options.catalogSha ||
    !options.modelVersion ||
    !options.status ||
    !options.siteName ||
    !options.subdomain ||
    !options.cloud ||
    !options.language ||
    !options.languageName
  ) {
    throw new Error(
      'Usage: render-non-spa-status.js [--output <path>] --templateName <name> ' +
      '--catalogOwner <owner> --catalogRepo <repo> --catalogSha <sha> ' +
      '--modelVersion <Enhanced|Standard> --status <status> ' +
      '--siteName <name> --subdomain <subdomain> --cloud <cloud> ' +
      '--language <lcid> --languageName <name> [--languageCode <code>] [--siteUrl <url>] ' +
      '[--websiteRecordId <guid>] [--actualModelVersion <Enhanced|Standard>] ' +
      '[--activityState <working|awaiting-input|failed|canceled>] ' +
      '[--requiredAction <text>] [--responseLocation <text>] ' +
      '[--terminalReason <text> --nextAction <text>]',
    );
  }

  const outputPath = options.output
    ? path.resolve(options.output)
    : path.join(
        os.tmpdir(),
        'power-platform-skills',
        'create-site',
        options.subdomain.replace(/[^a-z0-9-]/gi, '-'),
        'status.html',
      );
  const loadTemplate = deps.loadNonSpaTemplatePresentation ||
    loadNonSpaTemplatePresentation;
  const template = await loadTemplate({
    owner: options.catalogOwner,
    repo: options.catalogRepo,
    sha: options.catalogSha,
    templateName: options.templateName,
    cacheRoot: options.cacheRoot,
  }, deps);
  const model = buildModel(options, template);
  renderTemplate({
    templatePath: path.join(__dirname, '..', 'assets', 'non-spa-creation-status-template.html'),
    outputPath,
    dataObject: {
      MODEL: model,
      CSP_IMAGE_SOURCES: 'data:',
      CSP_CONNECT_SOURCES: "'none'",
    },
    requiredKeys: ['MODEL', 'CSP_IMAGE_SOURCES', 'CSP_CONNECT_SOURCES'],
    overwrite: true,
    emitStatus: false,
  });

  return {
    status: 'ok',
    output: outputPath,
    url: pathToFileURL(outputPath).href,
    creationStatus: options.status,
  };
}

async function main() {
  try {
    const result = await renderStatusPage(parseArgs(process.argv));
    process.stdout.write(`${JSON.stringify(result)}\n`);
  } catch (error) {
    process.stderr.write(`${error.message}\n`);
    process.exitCode = 1;
  }
}

if (require.main === module) {
  main();
}

module.exports = {
  ACTIVITY_STATES,
  STATUSES,
  TIMELINE,
  buildModel,
  renderStatusPage,
  validatePlainTextOption,
  validateWebsiteUrl,
};
writing-skillsobra/superpowersUse when creating new skills, editing existing skills, or verifying skills work before deploymentStars: 322kUpdated Claude CodeCodexVerifiedInstall
xlsxanthropics/skillsUse this skill any time a spreadsheet file is the primary input or output. This means any task where the user wants to: open, read, edit, or fix an existing .xlsx, .xlsm, .xltx, .csv, or .tsv file (e.g., adding columns, computing formulas, formatting, charting, cleaning messy data); create a new spreadsheet from scratch or from other data sources; or convert between tabular file formats. Trigger especially when the user references a spreadsheet file by name or path — even casually (like "the xlsx in my downloads") — and wants something done to it or produced from it. Also trigger for cleaning or restructuring messy tabular data files (malformed rows, misplaced headers, junk data) into proper spreadsheets. The deliverable must be a spreadsheet file. Do NOT trigger when the primary deliverable is a Word document, HTML report, standalone Python script, database pipeline, or Google Sheets API integration, even if tabular data is involved.Stars: 198kUpdated Claude CodeCodexVerifiedInstall
shipping-and-launchaddyosmani/agent-skillsPrepares production launches. Use when preparing to deploy to production, or when asking what needs to be in place before shipping. Use when you need a pre-launch checklist, when setting up monitoring, when planning a staged rollout, or when you need a rollback strategy.Stars: 119kUpdated Claude CodeCodexVerifiedInstall
childhoodthedotmack/claude-memBabysit a shipped release after merge, publication, or deployment. Verify published packages, production behavior, installed plugins, and late CI or user reports until the observation window is clean; use babysit for PR readiness before release.Stars: 118kUpdated Claude CodeCodexVerifiedInstall