The c15t-docs repository has been restructured to use a template-based approach. The template is now located at c15t-docs/templates/c15t instead of being the root of the repository. This plan outlines the changes needed to update the GitHub action to work with this new structure.
- GitHub Action calls
setupDocsWithScript()which runspnpm tsx scripts/setup-docs.ts --vercel setup-docs.tsclones the entireconsentdotio/c15t-docsrepository- Copies the entire repo to
.docsdirectory - Installs dependencies in
.docs - Vercel deploys from
.docs
- The script clones the entire
c15t-docsrepo but should only extracttemplates/c15t - The template structure has changed, requiring extraction from a subdirectory
- The template has its own content pulling mechanism (
scripts/content/pull.ts) that needs to run
- GitHub Action calls
setupDocsWithScript()which runspnpm tsx scripts/setup-docs.ts --vercel setup-docs.tsclonesconsentdotio/c15t-docsrepository entirely to.docs- Clean up unwanted templates: Remove any templates in
.docs/templates/that aren'tc15t - Install workspace dependencies from
.docsroot (installs packages + template dependencies) - Run template's content pull script (
templates/c15t/scripts/content/pull.ts) which:- Pulls docs/packages/changelog from
c15t/c15trepo - Creates
.docs/templates/c15t/.c15t/directory structure - Copies content into
.c15t/docs/,.c15t/packages/,.c15t/changelog/
- Pulls docs/packages/changelog from
- Build and deploy from
.docs/templates/c15t/(Vercel working directory)
Why This Is Simpler:
- No selective file copying needed
- Clone entire repo once (we need packages anyway)
- Just remove unwanted templates after clone
- Workspace structure is already correct
- Less code, fewer edge cases
.docs/
├── package.json (root workspace config)
├── pnpm-workspace.yaml
├── packages/ (all packages needed for compilation)
│ ├── icon-scanner/
│ ├── mdx-components/
│ ├── og/
│ ├── optin/
│ ├── optin-docs/
│ ├── optin-flags/
│ └── optin-icons/
└── templates/
└── c15t/ (only this template, not others)
├── .c15t/ (created by pull script)
│ ├── docs/ (pulled from c15t/c15t repo)
│ ├── packages/ (pulled from c15t/c15t repo)
│ └── changelog/ (pulled from c15t/c15t repo)
├── src/
├── scripts/
└── ... (template files)
Content Flow:
- Clone
c15t-docsrepo →.docs/(workspace + packages + templates/c15t) - Remove unwanted templates from
.docs/templates/ - Install workspace dependencies from
.docs/root - Run
templates/c15t/scripts/content/pull.ts→ pulls content into.docs/templates/c15t/.c15t/ - Build and deploy from
.docs/templates/c15t/
File: /Users/christopherburns/glados/c/c15t/scripts/setup-docs.ts
Changes Needed:
- Modify
installDocumentationTemplate()function to copy entire repo, then clean up unwanted templates - Copy entire cloned repo to
.docs(includes root, packages, templates) - Remove any templates that aren't
c15tfrom.docs/templates/ - Install dependencies from
.docsroot using workspace-aware install - After installation, run template's content pull script:
cd .docs/templates/c15t && pnpm tsx scripts/content/pull.ts --vercel
Key Code Changes:
// Current (line ~512):
cpSync(FETCH_CONFIG.TEMP_DOCS_DIR, FETCH_CONFIG.DOCS_APP_DIR, {
recursive: true,
});
// New: Copy entire repo, then remove unwanted templates
function installDocumentationTemplate(
buildMode: BuildMode,
branch: GitBranch
): void {
cleanupDirectory(FETCH_CONFIG.DOCS_APP_DIR, 'existing docs workspace', buildMode, branch);
// Copy entire cloned repository (includes root, packages, templates)
cpSync(FETCH_CONFIG.TEMP_DOCS_DIR, FETCH_CONFIG.DOCS_APP_DIR, {
recursive: true,
});
// Remove any templates that aren't 'c15t'
const templatesDir = join(FETCH_CONFIG.DOCS_APP_DIR, 'templates');
if (existsSync(templatesDir)) {
const templates = readdirSync(templatesDir, { withFileTypes: true });
for (const template of templates) {
if (template.isDirectory() && template.name !== 'c15t') {
const templatePath = join(templatesDir, template.name);
log(`Removing unwanted template: ${template.name}`);
rmSync(templatePath, { recursive: true, force: true });
}
}
}
}File: /Users/christopherburns/glados/c/c15t/scripts/setup-docs.ts
Changes Needed:
- Update
installDocsAppDependencies()to install from.docsroot (workspace root) - Use
pnpm install --frozen-lockfilefrom.docsdirectory - This will install all workspace dependencies including template and packages
- The template's dependencies will be resolved via workspace protocol
Key Code Changes:
// Current (line ~594):
executeCommand(
`cd ${FETCH_CONFIG.DOCS_APP_DIR} && pnpm install --ignore-workspace --frozen-lockfile`,
'Installing .docs dependencies in isolation',
buildMode,
branch
);
// New: Install workspace dependencies
executeCommand(
`cd ${FETCH_CONFIG.DOCS_APP_DIR} && pnpm install --frozen-lockfile`,
'Installing workspace dependencies',
buildMode,
branch
);File: /Users/christopherburns/glados/c/consent-github-actions/docs-preview-action/src/steps/setup-docs.ts
Changes Needed:
- Ensure the script path is correct (
scripts/setup-docs.tsexists in c15t repo) - Verify the script is called with
--vercelflag for production builds - The script should handle the new workspace structure automatically
Current Implementation: ✅ Already correct - calls pnpm tsx scripts/setup-docs.ts --vercel
File: /Users/christopherburns/glados/c/c15t/scripts/setup-docs.ts
Changes Needed:
- After installing workspace dependencies, run the template's content pull script
- This script (
templates/c15t/scripts/content/pull.ts) pulls docs/packages/changelog fromc15t/c15trepo - The script creates
.docs/templates/c15t/.c15t/directory and populates it with content - Must run with
--vercelflag in production mode to use environment token - Run from
.docs/templates/c15tdirectory (script expects to run from template root)
New Function to Add:
function pullTemplateContent(
buildMode: BuildMode,
branch: GitBranch
): void {
const templateDir = join(FETCH_CONFIG.DOCS_APP_DIR, 'templates', 'c15t');
if (buildMode === 'production') {
// In production, the template's pull script will use CONSENT_GIT_TOKEN from env
// This creates .c15t/ directory inside the template with docs/packages/changelog
executeCommand(
`cd ${templateDir} && pnpm tsx scripts/content/pull.ts --vercel --branch=${branch}`,
'Pulling content from c15t repository into .c15t/',
buildMode,
branch
);
} else {
// In development, use default branch (main)
executeCommand(
`cd ${templateDir} && pnpm tsx scripts/content/pull.ts --branch=${branch}`,
'Pulling content from c15t repository into .c15t/',
buildMode,
branch
);
}
}Result: After this step, .docs/templates/c15t/.c15t/ will contain:
.c15t/docs/- Documentation content from c15t/c15t repo.c15t/packages/- Package source code from c15t/c15t repo.c15t/changelog/- Changelog entries from c15t/c15t repo
Consideration: The template's vercel.json specifies:
{
"installCommand": "cd ../.. && pnpm install --filter c15t-docs",
"buildCommand": "pnpm build"
}Options:
-
Option A (Recommended): Set
working_directoryto.docs/templates/c15tin GitHub Action- Vercel will deploy from template directory
- Install command will go up two levels to
.docsroot - Workspace dependencies will be resolved correctly
-
Option B: Keep
working_directoryas.docsand update vercel.json- Would need to modify vercel.json install command
- Less clean separation
Recommendation: Use Option A - set working directory to .docs/templates/c15t in the GitHub Action workflow.
File: /Users/christopherburns/glados/c/c15t/.github/workflows/deploy-docs.yml
Current Configuration:
working_directory: .docs(default)framework: nextjs(default)
Changes Needed:
- Update
working_directoryto.docs/templates/c15tto deploy from template directory - This allows Vercel's install command (
cd ../.. && pnpm install --filter c15t-docs) to work correctly - The install command will go up two levels from template to
.docsroot, then install workspace dependencies
Update Required:
# In workflow file, update both preview and production steps:
working_directory: .docs/templates/c15t- Modify
installDocumentationTemplate()to copy entire repo - Add cleanup step to remove unwanted templates (keep only
c15t) - Add import for
readdirSyncandrmSyncif not already present - Verify workspace structure is correct after copy
- Modify
installDocsAppDependencies()to install from workspace root - Remove
--ignore-workspaceflag to enable workspace dependency resolution - Install from
.docsroot directory - Verify workspace dependencies resolve correctly
- Add
pullTemplateContent()function - Call it after workspace dependency installation
- Run from
.docs/templates/c15tdirectory - Ensure it uses correct branch and production flags
- Update workflow file to set
working_directory: .docs/templates/c15t - Update both preview and production deployment steps
- Verify Vercel install command works correctly
- Test locally with
tsx scripts/setup-docs.ts(development mode) - Test with
tsx scripts/setup-docs.ts --vercel(production mode) - Verify
.docsworkspace structure is correct:- Root files present (package.json, pnpm-workspace.yaml)
- All packages copied
- Only
templates/c15tpresent (not other templates)
- Verify workspace dependencies install correctly
- Verify content is pulled correctly from
c15t/c15tinto.docs/templates/c15t/.c15t/ - Verify
.c15t/directory structure is correct (docs/, packages/, changelog/) - Test GitHub Action workflow end-to-end
- Verify Vercel deployment succeeds from
.docs/templates/c15t/
- Update script comments to reflect new workspace structure
- Update error messages to reference correct paths
- Document the three-step process (workspace setup + dependency install + content pull)
-
/Users/christopherburns/glados/c/c15t/scripts/setup-docs.ts- Update
installDocumentationTemplate()to create workspace structure - Update
installDocsAppDependencies()to use workspace install - Add
pullTemplateContent()function - Update main() function to call content pull
- Update documentation/comments
- Update
-
/Users/christopherburns/glados/c/c15t/.github/workflows/deploy-docs.yml- Update
working_directoryto.docs/templates/c15tfor both preview and production steps
- Update
/Users/christopherburns/glados/c/consent-github-actions/docs-preview-action/src/steps/setup-docs.ts- Verify script path is correct
- Verify flags are passed correctly
- No changes needed
- Template extraction works correctly
- Content pull script runs successfully
- Dependencies install correctly in
.docs - Template's build scripts work
- Vercel deployment succeeds
- Preview deployments work
- Production deployments work
- Branch-specific deployments work (main/canary)
If issues occur:
- Revert changes to
setup-docs.ts - The old script structure should still work if template is moved back
- Keep a backup of the current working version
- Simplified Approach: Clone entire repo, remove unwanted templates, proceed. Much simpler than selective copying.
- The template uses workspace dependencies (
workspace:*) that require the full workspace structure - All packages in
packages/are needed for compilation (mdx-components, optin, og, etc.) - The template's
vercel.jsonusesinstallCommand: "cd ../.. && pnpm install --filter c15t-docs"which expects to be intemplates/c15twith workspace root two levels up - The template's
scripts/content/pull.tspulls content fromc15t/c15trepo and creates.c15t/directory inside the template - The template's
source.config.tsreferences./.c15t/docs- content must be in template directory - This is a four-phase setup: clone repo + cleanup templates + dependency installation + content pull
- The workspace structure must match
c15t-docsmonorepo structure for dependency resolution to work - Currently only
c15ttemplate exists, but cleanup handles future templates gracefully - Final structure:
.docs/templates/c15t/contains both template code AND.c15t/content directory