A package to centralize SEO related logic for SBLP and Sitemap Generator.
ContentBuilder
DocumentBuilder generates the content for the main index page and each
ConfluenceUpdater creates or updates pages in Confluence as needed
CONFLUENCE_EMAIL=your-email@example.com
CONFLUENCE_API_TOKEN=your-api-token
CONFLUENCE_BASE_URL=https://your-instance.atlassian.net
CONFLUENCE_SPACE_KEY=YOUR_SPACE_KEY
CONFLUENCE_MAIN_PAGE_TITLE=Fawkes Indexing Rules Documentation
`
> Important Note on Credentials: Currently, the system uses personal
> credentials (email and API token) for Confluence access. This is a temporary
> solution and should be replaced with a team or service account in the future
> to avoid dependency on a specific individual's account.
$3
The system runs as an AWS Lambda function and is automatically triggered as part
of the CI/CD pipeline. This ensures documentation is always updated whenever new
code is deployed:
`yaml
buildspec.yml (excerpt)
post_build:
commands:
- |
if [ -z "$PR_ID" ]; then
LAMBDA_NAME="FawkesConfluenceUpdater-$STAGE"
echo "Invoking Lambda function $LAMBDA_NAME"
echo '{"source":"cicd-pipeline","timestamp":"'$(date -u +"%Y-%m-%dT%H:%M:%SZ")'"}' > payload.json
aws lambda invoke --function-name $LAMBDA_NAME --invocation-type Event --payload fileb://payload.json response.json || echo "Lambda invocation failed, but continuing"
fi
`
Trigger Flow:
1. When code is pushed to the main branch, the CI/CD pipeline is triggered
2. After successful deployment of a new Fawkes version, the post-build phase
executes
3. The Lambda function is invoked with a simple payload containing the source
and timestamp
4. The Lambda function authenticates with Confluence and executes the
documentation generation process
5. This only happens for production deployments (not PR builds)
This automated approach ensures documentation stays in sync with the actual
codebase without manual intervention.
Scalability and Extension
$3
To add documentation for a new project:
1. Create a new class that implements the IPolicyFetcher interface
2. Implement the getProjectName() and fetchPolicies() methods
3. Register the new fetcher in the ContentBuilder constructor
Example:
`typescript
export class NewProjectPolicyFetcher implements IPolicyFetcher {
getProjectName(): string {
return 'New Project Name';
}
fetchPolicies(): IPolicy[] {
// Implement policy fetching logic
return [...policies];
}
}
// Then update ContentBuilder:
constructor(fetchers?: IPolicyFetcher[]) {
this.policyFetchers = fetchers || [
// Existing fetchers
new NewProjectPolicyFetcher()
];
}
`
$3
The DocumentBuilder class contains methods for generating page content. To
customize the format:
1. Modify the buildMainDocument() method for changes to the main index page
2. Modify the buildProjectDocument() method for changes to project pages
3. Modify the buildPolicySection() and buildRulesTable()` methods for changes