refactor: parameterize environment — no hardcoded paths
Configuration (CLONE_DIR, CLONE_HOST, GIT_REMOTE, GIT_ORG, GIT_TOKEN_PATH) provided by invoker's workspace context. Commands reference shows Gitea + GitHub examples.
This commit is contained in:
@@ -17,12 +17,25 @@ description: >-
|
|||||||
# Codebase Analysis
|
# Codebase Analysis
|
||||||
|
|
||||||
Extract architectural conventions from open source repositories.
|
Extract architectural conventions from open source repositories.
|
||||||
Output: Gitea repos under `rodin/<project>-conventions`.
|
Output: convention repos (one per project analyzed).
|
||||||
|
|
||||||
|
## Configuration
|
||||||
|
|
||||||
|
These are provided by the invoker's environment (TOOLS.md, AGENTS.md,
|
||||||
|
or invocation context):
|
||||||
|
|
||||||
|
- **CLONE_DIR** — where to clone repos (e.g., `~/src/analysis/`)
|
||||||
|
- **CLONE_HOST** — which machine to clone on (needs disk + git)
|
||||||
|
- **GIT_REMOTE** — where convention repos are pushed (e.g., Gitea, GitHub)
|
||||||
|
- **GIT_ORG** — organization/user for convention repos
|
||||||
|
- **GIT_TOKEN_PATH** — path to auth token for pushing
|
||||||
|
|
||||||
|
If not explicitly provided, infer from workspace context.
|
||||||
|
|
||||||
## Naming
|
## Naming
|
||||||
|
|
||||||
- `*-patterns` = language-level (go-patterns, elixir-patterns)
|
- `*-patterns` = language-level (how the language wants you to write)
|
||||||
- `*-conventions` = project-specific (temporal-conventions, etc.)
|
- `*-conventions` = project-specific (how a codebase chose to do it)
|
||||||
|
|
||||||
## Thinking Framework
|
## Thinking Framework
|
||||||
|
|
||||||
@@ -61,7 +74,7 @@ Skip patterns that are:
|
|||||||
|
|
||||||
### Phase 1: Shape (5 min)
|
### Phase 1: Shape (5 min)
|
||||||
|
|
||||||
Clone on forge (`~/src/analysis/<name>`). Full clone — never shallow.
|
Clone to `CLONE_DIR/<name>` on `CLONE_HOST`. Full clone — never shallow.
|
||||||
|
|
||||||
Measure: size, files, commits, contributors, top-level dirs.
|
Measure: size, files, commits, contributors, top-level dirs.
|
||||||
|
|
||||||
@@ -226,7 +239,7 @@ See `references/pattern-breaks.md` for real examples with git history.
|
|||||||
|
|
||||||
## Output Repos
|
## Output Repos
|
||||||
|
|
||||||
Push to Gitea under `rodin/<project>-conventions`. See
|
Push to `GIT_REMOTE` under `GIT_ORG/<project>-conventions`. See
|
||||||
`references/commands.md` for repo creation and push commands.
|
`references/commands.md` for repo creation and push commands.
|
||||||
|
|
||||||
## Fallbacks
|
## Fallbacks
|
||||||
@@ -244,7 +257,7 @@ Push to Gitea under `rodin/<project>-conventions`. See
|
|||||||
|
|
||||||
## Execution Notes
|
## Execution Notes
|
||||||
|
|
||||||
- Clone on **forge** (`host="node", node="forge"`)
|
- Clone on `CLONE_HOST` — needs disk space for full git history
|
||||||
- `gh api` for GitHub PR lookups (authenticated on all nodes)
|
- `gh api` for GitHub PR lookups (requires authenticated `gh` CLI)
|
||||||
- One repo at a time for focused analysis
|
- One repo at a time for focused analysis
|
||||||
- Markdownlint all output before pushing
|
- Markdownlint all output before pushing
|
||||||
|
|||||||
+11
-8
@@ -9,7 +9,7 @@ syntax — the SKILL.md tells you WHAT to look for; this tells you HOW.
|
|||||||
|
|
||||||
```bash
|
```bash
|
||||||
# Clone (always full — never --depth 1)
|
# Clone (always full — never --depth 1)
|
||||||
cd ~/src/analysis && git clone <url>
|
cd $CLONE_DIR && git clone <url>
|
||||||
|
|
||||||
# Dimensions
|
# Dimensions
|
||||||
du -sh <repo>
|
du -sh <repo>
|
||||||
@@ -103,20 +103,23 @@ gh api repos/<org>/<repo>/issues/<num>/comments \
|
|||||||
|
|
||||||
## Output: Repo Creation & Push
|
## Output: Repo Creation & Push
|
||||||
|
|
||||||
```bash
|
Adapt to your git remote (Gitea, GitHub, GitLab, etc.):
|
||||||
GITEA_TOKEN=$(cat ~/.openclaw/credentials/gitea-rodin)
|
|
||||||
|
|
||||||
# Create repo
|
```bash
|
||||||
curl -s -X POST "https://gitea.weiker.me/api/v1/user/repos" \
|
# Gitea example:
|
||||||
|
GITEA_TOKEN=$(cat $GIT_TOKEN_PATH)
|
||||||
|
curl -s -X POST "https://<git-host>/api/v1/user/repos" \
|
||||||
-H "Authorization: token $GITEA_TOKEN" \
|
-H "Authorization: token $GITEA_TOKEN" \
|
||||||
-H "Content-Type: application/json" \
|
-H "Content-Type: application/json" \
|
||||||
-d '{"name": "<project>-conventions", "auto_init": true, "default_branch": "master", "license": "MIT"}'
|
-d '{"name": "<project>-conventions", "auto_init": true, "default_branch": "master", "license": "MIT"}'
|
||||||
|
|
||||||
|
# GitHub example:
|
||||||
|
gh repo create $GIT_ORG/<project>-conventions --public --clone
|
||||||
|
|
||||||
# Clone, add content, push
|
# Clone, add content, push
|
||||||
git clone "https://rodin:${GITEA_TOKEN}@gitea.weiker.me/rodin/<project>-conventions.git"
|
|
||||||
cd <project>-conventions
|
cd <project>-conventions
|
||||||
git config user.name "Rodin"
|
git config user.name "<your-name>"
|
||||||
git config user.email "rodin@forgedthought.ai"
|
git config user.email "<your-email>"
|
||||||
# ... add files ...
|
# ... add files ...
|
||||||
git add -A && git commit -m "docs: initial conventions from <org>/<project>" && git push
|
git add -A && git commit -m "docs: initial conventions from <org>/<project>" && git push
|
||||||
```
|
```
|
||||||
|
|||||||
Reference in New Issue
Block a user