Files
dss/.gitlab-ci.yml
Digital Production Factory d53b61008c feat(analysis): Implement project analysis engine and CI/CD workflow
This commit introduces a new project analysis engine to the DSS.

Key features include:
- A new analysis module in `dss-mvp1/dss/analyze` that can parse React projects and generate a dependency graph.
- A command-line interface (`dss-mvp1/dss-cli.py`) to run the analysis, designed for use in CI/CD pipelines.
- A new `dss_project_export_context` tool in the Claude MCP server to allow AI agents to access the analysis results.
- A `.gitlab-ci.yml` file to automate the analysis on every push, ensuring the project context is always up-to-date.
- Tests for the new analysis functionality.

This new architecture enables DSS to have a deep, version-controlled understanding of a project's structure, which can be used to power more intelligent agents and provide better developer guidance. The analysis is no longer automatically triggered on `init`, but is designed to be run manually or by a CI/CD pipeline.
2025-12-10 11:05:27 -03:00

64 lines
2.5 KiB
YAML

# .gitlab-ci.yml
# Define the stages for the pipeline. We only need one for this task.
stages:
- analyze
# This is the main job that will run the DSS analysis.
dss_context_update:
stage: analyze
# Use a Docker image that has Python and Node.js.
# 'node:18-bullseye' is a good choice as it has a recent Node.js and Python 3.9+.
image: node:18-bullseye
# before_script runs before the main 'script' section.
# It's used for setup and configuration.
before_script:
- echo "Setting up the environment for DSS..."
# Update package lists and install Git and Python pip
- apt-get update && apt-get install -y git python3-pip
# Install Python dependencies
- pip3 install -r requirements.txt
# Install Node.js dependencies (within the dss-mvp1 directory)
- cd dss-mvp1 && npm install && cd ..
# --- Git Configuration ---
# Configure Git with a dedicated user for the DSS agent.
# This makes it clear which commits are automated.
- git config --global user.email "dss-agent@your-gitlab-instance.com"
- git config --global user.name "DSS Agent"
# The main part of the job.
script:
- echo "Running DSS project analysis..."
# Run the DSS CLI to analyze the project.
# The output of this command will be the updated project_context.json file.
- python3 dss-mvp1/dss-cli.py analyze --project-path .
# --- Commit and Push Changes ---
# Check if the analysis generated any changes to the context file.
# 'git status --porcelain' provides a clean, scriptable output.
- |
if git status --porcelain | grep -q '.dss/analysis_graph.json'; then
echo "Change detected in analysis_graph.json. Committing and pushing..."
# Add the file to the staging area.
git add .dss/analysis_graph.json
# Commit the changes with a standardized message.
git commit -m "chore(dss): Update project analysis context [skip ci]"
# Push the commit back to the same branch.
# We use the GITLAB_TOKEN we configured earlier for authentication.
# The [skip ci] in the commit message prevents this push from triggering a new pipeline run, avoiding an infinite loop.
git push "https://gitlab-ci-token:${GITLAB_TOKEN}@${CI_SERVER_HOST}/${CI_PROJECT_PATH}.git" "HEAD:${CI_COMMIT_REF_NAME}"
else
echo "No changes detected in project context. Nothing to commit."
fi
# Rules define when this job should run.
rules:
# Run the job for any pushes to branches (but not tags).
- if: '$CI_COMMIT_TAG == null'