@tosanoob/acs 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +262 -0
- package/dist/cli/init.d.ts +4 -0
- package/dist/cli/init.d.ts.map +1 -0
- package/dist/cli/init.js +174 -0
- package/dist/cli/init.js.map +1 -0
- package/dist/cli/onboard.d.ts +2 -0
- package/dist/cli/onboard.d.ts.map +1 -0
- package/dist/cli/onboard.js +37 -0
- package/dist/cli/onboard.js.map +1 -0
- package/dist/cli/pr.d.ts +5 -0
- package/dist/cli/pr.d.ts.map +1 -0
- package/dist/cli/pr.js +90 -0
- package/dist/cli/pr.js.map +1 -0
- package/dist/cli/retry.d.ts +2 -0
- package/dist/cli/retry.d.ts.map +1 -0
- package/dist/cli/retry.js +79 -0
- package/dist/cli/retry.js.map +1 -0
- package/dist/cli/skip.d.ts +2 -0
- package/dist/cli/skip.d.ts.map +1 -0
- package/dist/cli/skip.js +30 -0
- package/dist/cli/skip.js.map +1 -0
- package/dist/cli/status.d.ts +2 -0
- package/dist/cli/status.d.ts.map +1 -0
- package/dist/cli/status.js +37 -0
- package/dist/cli/status.js.map +1 -0
- package/dist/cli/why.d.ts +4 -0
- package/dist/cli/why.d.ts.map +1 -0
- package/dist/cli/why.js +49 -0
- package/dist/cli/why.js.map +1 -0
- package/dist/core/aiignore.d.ts +8 -0
- package/dist/core/aiignore.d.ts.map +1 -0
- package/dist/core/aiignore.js +111 -0
- package/dist/core/aiignore.js.map +1 -0
- package/dist/core/changelog.d.ts +26 -0
- package/dist/core/changelog.d.ts.map +1 -0
- package/dist/core/changelog.js +107 -0
- package/dist/core/changelog.js.map +1 -0
- package/dist/core/config.d.ts +11 -0
- package/dist/core/config.d.ts.map +1 -0
- package/dist/core/config.js +33 -0
- package/dist/core/config.js.map +1 -0
- package/dist/core/detector.d.ts +10 -0
- package/dist/core/detector.d.ts.map +1 -0
- package/dist/core/detector.js +54 -0
- package/dist/core/detector.js.map +1 -0
- package/dist/core/git.d.ts +20 -0
- package/dist/core/git.d.ts.map +1 -0
- package/dist/core/git.js +90 -0
- package/dist/core/git.js.map +1 -0
- package/dist/core/installer.d.ts +10 -0
- package/dist/core/installer.d.ts.map +1 -0
- package/dist/core/installer.js +128 -0
- package/dist/core/installer.js.map +1 -0
- package/dist/core/schema.d.ts +18 -0
- package/dist/core/schema.d.ts.map +1 -0
- package/dist/core/schema.js +70 -0
- package/dist/core/schema.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +71 -0
- package/dist/index.js.map +1 -0
- package/package.json +52 -0
- package/src/hooks/post-commit.sh +107 -0
- package/src/hooks/pre-commit.sh +159 -0
- package/src/skills/claude-code/SKILL.md +100 -0
- package/src/skills/codex/acs-context.md +62 -0
- package/src/skills/shared/AGENTS.md.tmpl +22 -0
- package/src/templates/CONSTITUTION.md.tmpl +32 -0
- package/src/templates/aiignore.default +45 -0
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# acs post-commit hook — validation + commit hash patch
|
|
3
|
+
# Runs AFTER every commit. Never blocks. Always exits 0.
|
|
4
|
+
# Installed by: acs init
|
|
5
|
+
set -uo pipefail
|
|
6
|
+
|
|
7
|
+
REPO_ROOT=$(git rev-parse --show-toplevel 2>/dev/null) || exit 0
|
|
8
|
+
CHANGELOGS_DIR="$REPO_ROOT/.ai/changelogs"
|
|
9
|
+
ERRORS_FILE="$REPO_ROOT/.ai/.errors"
|
|
10
|
+
|
|
11
|
+
# ── Guard: amend re-entry ────────────────────────────────────────────────────
|
|
12
|
+
# When this hook amends the commit (to patch Commit: PENDING), git re-fires
|
|
13
|
+
# the post-commit hook. Exit immediately to prevent infinite amend loops.
|
|
14
|
+
if [ -n "${ACS_AMEND_RUNNING:-}" ]; then
|
|
15
|
+
exit 0
|
|
16
|
+
fi
|
|
17
|
+
|
|
18
|
+
# ── Guard: [acs] tag ─────────────────────────────────────────────────────────
|
|
19
|
+
# Doc commits (enrichment, rename) skip validation.
|
|
20
|
+
COMMIT_MSG=$(git log -1 --format='%s' 2>/dev/null || echo "")
|
|
21
|
+
if echo "$COMMIT_MSG" | grep -qF '[acs]'; then
|
|
22
|
+
exit 0
|
|
23
|
+
fi
|
|
24
|
+
|
|
25
|
+
# ── Get the commit hash that was just made ───────────────────────────────────
|
|
26
|
+
COMMIT_HASH=$(git rev-parse HEAD 2>/dev/null) || exit 0
|
|
27
|
+
SHORT_HASH="${COMMIT_HASH:0:8}"
|
|
28
|
+
|
|
29
|
+
# ── Patch "PENDING" in any changelog written by pre-commit ──────────────────
|
|
30
|
+
# The pre-commit hook wrote Commit: PENDING because the hash wasn't known yet.
|
|
31
|
+
if [ -d "$CHANGELOGS_DIR" ]; then
|
|
32
|
+
for f in "$CHANGELOGS_DIR"/changelog-*.md; do
|
|
33
|
+
[ -f "$f" ] || continue
|
|
34
|
+
if grep -q '^Commit: PENDING$' "$f" 2>/dev/null; then
|
|
35
|
+
# Patch the PENDING placeholder with the real hash
|
|
36
|
+
sed -i "s/^Commit: PENDING$/Commit: $COMMIT_HASH/" "$f"
|
|
37
|
+
# Stage the patched file and amend silently.
|
|
38
|
+
# ACS_AMEND_RUNNING prevents the hook from re-entering on the amend.
|
|
39
|
+
git add "$f" 2>/dev/null
|
|
40
|
+
ACS_AMEND_RUNNING=1 GIT_EDITOR=true git commit --amend --no-edit 2>/dev/null || true
|
|
41
|
+
break
|
|
42
|
+
fi
|
|
43
|
+
done
|
|
44
|
+
fi
|
|
45
|
+
|
|
46
|
+
# ── Schema validation ────────────────────────────────────────────────────────
|
|
47
|
+
# Find the changelog for this commit and validate its schema.
|
|
48
|
+
REQUIRED_SECTIONS=(
|
|
49
|
+
"## What Changed"
|
|
50
|
+
"## Why (AI Context)"
|
|
51
|
+
"## Architectural Impact"
|
|
52
|
+
"## Patterns Used"
|
|
53
|
+
"## Integration Points"
|
|
54
|
+
"## Gotchas"
|
|
55
|
+
"## How to Extend"
|
|
56
|
+
)
|
|
57
|
+
|
|
58
|
+
CHANGELOG_FILE=""
|
|
59
|
+
if [ -d "$CHANGELOGS_DIR" ]; then
|
|
60
|
+
for f in "$CHANGELOGS_DIR"/changelog-*.md; do
|
|
61
|
+
[ -f "$f" ] || continue
|
|
62
|
+
if grep -q "^Commit: $COMMIT_HASH" "$f" 2>/dev/null; then
|
|
63
|
+
CHANGELOG_FILE="$f"
|
|
64
|
+
break
|
|
65
|
+
fi
|
|
66
|
+
done
|
|
67
|
+
fi
|
|
68
|
+
|
|
69
|
+
if [ -z "$CHANGELOG_FILE" ]; then
|
|
70
|
+
# No changelog found for this commit — log and exit
|
|
71
|
+
mkdir -p "$REPO_ROOT/.ai"
|
|
72
|
+
echo "[$(date -u +%Y-%m-%dT%H:%M:%SZ)] MISSING_CHANGELOG commit=$SHORT_HASH msg='$COMMIT_MSG'" >> "$ERRORS_FILE"
|
|
73
|
+
exit 0
|
|
74
|
+
fi
|
|
75
|
+
|
|
76
|
+
# Validate each required section exists
|
|
77
|
+
VALIDATION_FAILED=0
|
|
78
|
+
for section in "${REQUIRED_SECTIONS[@]}"; do
|
|
79
|
+
if ! grep -qF "$section" "$CHANGELOG_FILE" 2>/dev/null; then
|
|
80
|
+
mkdir -p "$REPO_ROOT/.ai"
|
|
81
|
+
echo "[$(date -u +%Y-%m-%dT%H:%M:%SZ)] SCHEMA_ERROR commit=$SHORT_HASH file=$(basename "$CHANGELOG_FILE") missing='$section'" >> "$ERRORS_FILE"
|
|
82
|
+
VALIDATION_FAILED=1
|
|
83
|
+
fi
|
|
84
|
+
done
|
|
85
|
+
|
|
86
|
+
# Check for secret-looking patterns in generated content
|
|
87
|
+
SECRET_PATTERNS=(
|
|
88
|
+
"-----BEGIN.*PRIVATE KEY-----"
|
|
89
|
+
"sk-[a-zA-Z0-9]{32}"
|
|
90
|
+
"ghp_[a-zA-Z0-9]{36}"
|
|
91
|
+
"AKIA[0-9A-Z]{16}"
|
|
92
|
+
)
|
|
93
|
+
for pattern in "${SECRET_PATTERNS[@]}"; do
|
|
94
|
+
if grep -qE "$pattern" "$CHANGELOG_FILE" 2>/dev/null; then
|
|
95
|
+
mkdir -p "$REPO_ROOT/.ai"
|
|
96
|
+
echo "[$(date -u +%Y-%m-%dT%H:%M:%SZ)] SECRET_PATTERN_DETECTED commit=$SHORT_HASH file=$(basename "$CHANGELOG_FILE") pattern='$pattern'" >> "$ERRORS_FILE"
|
|
97
|
+
VALIDATION_FAILED=1
|
|
98
|
+
fi
|
|
99
|
+
done
|
|
100
|
+
|
|
101
|
+
if [ "$VALIDATION_FAILED" -eq 1 ]; then
|
|
102
|
+
# Rename to .FAILED so acs status can find it
|
|
103
|
+
mv "$CHANGELOG_FILE" "${CHANGELOG_FILE%.md}.FAILED.md" 2>/dev/null || true
|
|
104
|
+
fi
|
|
105
|
+
|
|
106
|
+
# Always exit 0 — never block the developer
|
|
107
|
+
exit 0
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# acs pre-commit hook — enforcement layer
|
|
3
|
+
# Ensures every commit includes a changelog in .ai/changelogs/
|
|
4
|
+
# Installed by: acs init
|
|
5
|
+
set -euo pipefail
|
|
6
|
+
|
|
7
|
+
ACS_CMD="${ACS_CMD:-acs}"
|
|
8
|
+
|
|
9
|
+
# ── Guard 1: [acs] tag ──────────────────────────────────────────────────────
|
|
10
|
+
# Enrichment and doc commits include [acs] in the message. Skip them.
|
|
11
|
+
COMMIT_MSG_FILE="${GIT_DIR:-.git}/COMMIT_EDITMSG"
|
|
12
|
+
if [ -f "$COMMIT_MSG_FILE" ]; then
|
|
13
|
+
if grep -qF '[acs]' "$COMMIT_MSG_FILE" 2>/dev/null; then
|
|
14
|
+
exit 0
|
|
15
|
+
fi
|
|
16
|
+
fi
|
|
17
|
+
|
|
18
|
+
# ── Guard 2: changelog already staged ───────────────────────────────────────
|
|
19
|
+
# Claude Code (primary path) stages the changelog before committing.
|
|
20
|
+
# If a .ai/changelogs/ file is already staged, nothing to do.
|
|
21
|
+
if git diff --cached --name-only 2>/dev/null | grep -q '^\.ai/changelogs/'; then
|
|
22
|
+
exit 0
|
|
23
|
+
fi
|
|
24
|
+
|
|
25
|
+
# ── Guard 3: merge commit ────────────────────────────────────────────────────
|
|
26
|
+
# Don't generate changelogs for merge commits.
|
|
27
|
+
if [ -f "${GIT_DIR:-.git}/MERGE_HEAD" ]; then
|
|
28
|
+
exit 0
|
|
29
|
+
fi
|
|
30
|
+
|
|
31
|
+
# ── Generate changelog ───────────────────────────────────────────────────────
|
|
32
|
+
# At this point: no AI tool staged a changelog. We write one.
|
|
33
|
+
|
|
34
|
+
REPO_ROOT=$(git rev-parse --show-toplevel 2>/dev/null) || exit 0
|
|
35
|
+
CHANGELOGS_DIR="$REPO_ROOT/.ai/changelogs"
|
|
36
|
+
mkdir -p "$CHANGELOGS_DIR"
|
|
37
|
+
|
|
38
|
+
# Timestamp + suffix for filename
|
|
39
|
+
TIMESTAMP=$(date -u +"%Y-%m-%dT%H-%M-%S")
|
|
40
|
+
SUFFIX=$(head -c 2 /dev/urandom | od -An -tx1 | tr -d ' \n' | head -c 4)
|
|
41
|
+
FILENAME="changelog-${TIMESTAMP}Z-${SUFFIX}.md"
|
|
42
|
+
FILEPATH="$CHANGELOGS_DIR/$FILENAME"
|
|
43
|
+
|
|
44
|
+
# Get diff of staged changes
|
|
45
|
+
STAGED_DIFF=$(git diff --cached --stat 2>/dev/null || echo "")
|
|
46
|
+
STAGED_FILES=$(git diff --cached --name-only 2>/dev/null | head -20 || echo "")
|
|
47
|
+
BRANCH=$(git rev-parse --abbrev-ref HEAD 2>/dev/null || echo "unknown")
|
|
48
|
+
AUTHOR=$(git config user.name 2>/dev/null || echo "unknown")
|
|
49
|
+
AUTHOR_EMAIL=$(git config user.email 2>/dev/null || echo "")
|
|
50
|
+
|
|
51
|
+
# Load llm_command from acs.config.json if present
|
|
52
|
+
LLM_CMD=""
|
|
53
|
+
ACS_CONFIG="$REPO_ROOT/acs.config.json"
|
|
54
|
+
if [ -f "$ACS_CONFIG" ]; then
|
|
55
|
+
LLM_CMD=$(node -e "try{const c=require('$ACS_CONFIG');process.stdout.write(c.llm_command||'')}catch(e){}" 2>/dev/null || "")
|
|
56
|
+
fi
|
|
57
|
+
|
|
58
|
+
if [ -n "$LLM_CMD" ]; then
|
|
59
|
+
# ── AI path: call LLM for rich changelog ──────────────────────────────────
|
|
60
|
+
CONSTITUTION=""
|
|
61
|
+
if [ -f "$REPO_ROOT/.ai/CONSTITUTION.md" ]; then
|
|
62
|
+
CONSTITUTION=$(head -100 "$REPO_ROOT/.ai/CONSTITUTION.md")
|
|
63
|
+
fi
|
|
64
|
+
|
|
65
|
+
PROMPT="You are writing an AI changelog for a git commit. Based on the staged diff below, generate a changelog following the exact schema. Every section requires minimum 2 sentences.
|
|
66
|
+
|
|
67
|
+
STAGED FILES:
|
|
68
|
+
$STAGED_FILES
|
|
69
|
+
|
|
70
|
+
STAGED DIFF (summary):
|
|
71
|
+
$STAGED_DIFF
|
|
72
|
+
|
|
73
|
+
PROJECT CONSTITUTION (for Patterns Used section):
|
|
74
|
+
$CONSTITUTION
|
|
75
|
+
|
|
76
|
+
Generate the changelog now. Start with the header fields, then each ## section. Do not add any text before the # AI Changelog line.
|
|
77
|
+
|
|
78
|
+
# AI Changelog
|
|
79
|
+
Commit: PENDING
|
|
80
|
+
Date: $(date -u +"%Y-%m-%dT%H:%M:%SZ")
|
|
81
|
+
Author: $AUTHOR <$AUTHOR_EMAIL>
|
|
82
|
+
Branch: $BRANCH
|
|
83
|
+
AI-Tool: ${ACS_AI_TOOL:-unknown}
|
|
84
|
+
Session-Quality: INFERRED
|
|
85
|
+
|
|
86
|
+
## What Changed
|
|
87
|
+
[fill in]
|
|
88
|
+
|
|
89
|
+
## Why (AI Context)
|
|
90
|
+
[fill in]
|
|
91
|
+
|
|
92
|
+
## Architectural Impact
|
|
93
|
+
[fill in]
|
|
94
|
+
|
|
95
|
+
## Patterns Used
|
|
96
|
+
[fill in]
|
|
97
|
+
|
|
98
|
+
## Integration Points
|
|
99
|
+
[fill in]
|
|
100
|
+
|
|
101
|
+
## Gotchas
|
|
102
|
+
[fill in]
|
|
103
|
+
|
|
104
|
+
## How to Extend
|
|
105
|
+
[fill in]"
|
|
106
|
+
|
|
107
|
+
# Call LLM (headless subprocess)
|
|
108
|
+
CHANGELOG_CONTENT=$(echo "$PROMPT" | timeout 60 $LLM_CMD 2>/dev/null) || CHANGELOG_CONTENT=""
|
|
109
|
+
|
|
110
|
+
if [ -n "$CHANGELOG_CONTENT" ]; then
|
|
111
|
+
echo "$CHANGELOG_CONTENT" > "$FILEPATH"
|
|
112
|
+
else
|
|
113
|
+
# LLM failed — fall through to minimal changelog
|
|
114
|
+
LLM_CMD=""
|
|
115
|
+
fi
|
|
116
|
+
fi
|
|
117
|
+
|
|
118
|
+
if [ -z "$LLM_CMD" ]; then
|
|
119
|
+
# ── Minimal path: no LLM, write metadata + file list ──────────────────────
|
|
120
|
+
FILE_COUNT=$(echo "$STAGED_FILES" | grep -c . || echo "0")
|
|
121
|
+
NOW=$(date -u +"%Y-%m-%dT%H:%M:%SZ")
|
|
122
|
+
|
|
123
|
+
cat > "$FILEPATH" << CHANGELOG
|
|
124
|
+
# AI Changelog
|
|
125
|
+
Commit: PENDING
|
|
126
|
+
Date: $NOW
|
|
127
|
+
Author: $AUTHOR <$AUTHOR_EMAIL>
|
|
128
|
+
Branch: $BRANCH
|
|
129
|
+
AI-Tool: none
|
|
130
|
+
Session-Quality: NO_AI
|
|
131
|
+
|
|
132
|
+
## What Changed
|
|
133
|
+
$FILE_COUNT file(s) staged for this commit: $STAGED_FILES. This changelog was generated by the acs fallback hook without AI assistance.
|
|
134
|
+
|
|
135
|
+
## Why (AI Context)
|
|
136
|
+
No AI tool active during this commit. This is a human-authored commit captured by the acs pre-commit fallback hook. Context can be enriched later by running \`acs retry\` inside a Claude Code or Codex session.
|
|
137
|
+
|
|
138
|
+
## Architectural Impact
|
|
139
|
+
Not assessed — no AI session context available. Run \`acs retry\` to enrich this changelog with architectural analysis.
|
|
140
|
+
|
|
141
|
+
## Patterns Used
|
|
142
|
+
Not assessed — no AI session context available. Run \`acs retry\` to add pattern analysis.
|
|
143
|
+
|
|
144
|
+
## Integration Points
|
|
145
|
+
Not assessed — no AI session context available. Run \`acs retry\` to identify integration points.
|
|
146
|
+
|
|
147
|
+
## Gotchas
|
|
148
|
+
Not assessed — no AI session context available. Run \`acs retry\` to add gotcha notes.
|
|
149
|
+
|
|
150
|
+
## How to Extend
|
|
151
|
+
Not assessed — no AI session context available. Run \`acs retry\` to add extension guidance.
|
|
152
|
+
CHANGELOG
|
|
153
|
+
fi
|
|
154
|
+
|
|
155
|
+
# Stage the changelog
|
|
156
|
+
git add "$FILEPATH"
|
|
157
|
+
|
|
158
|
+
# Note: commit hash is "PENDING" here — post-commit hook patches it
|
|
159
|
+
exit 0
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
# ACS — AI Context Sync
|
|
2
|
+
|
|
3
|
+
This project uses **ai-context-sync (acs)**. The `.ai/` directory is the team's shared AI memory. Read it before starting. Write to it after committing.
|
|
4
|
+
|
|
5
|
+
## Before Starting Any Task
|
|
6
|
+
|
|
7
|
+
1. Read `.ai/CONSTITUTION.md` — project patterns, conventions, anti-patterns (latest section for each heading)
|
|
8
|
+
2. Read the 5 most recent files in `.ai/changelogs/` (sorted by filename, newest-last, read from the end)
|
|
9
|
+
3. If any `.ai/.pending-*` files exist, offer to enrich them (see Enrichment below)
|
|
10
|
+
|
|
11
|
+
## After Every Git Commit
|
|
12
|
+
|
|
13
|
+
**If you ran `git commit` as part of your work**, generate and write a changelog immediately after:
|
|
14
|
+
|
|
15
|
+
1. Get the commit hash: run `git rev-parse HEAD`
|
|
16
|
+
2. Get the diff: run `git show HEAD --format= -p`
|
|
17
|
+
3. Read `.ai/CONSTITUTION.md` (for patterns reference)
|
|
18
|
+
4. Generate the changelog (see Schema below)
|
|
19
|
+
5. Write it to `.ai/changelogs/changelog-<ISO-timestamp>Z-<4-char-hex>.md`
|
|
20
|
+
- Timestamp format: `2026-04-03T15-30-00` (colons replaced with hyphens)
|
|
21
|
+
- 4-char hex: use any unique suffix (e.g. first 4 chars of commit hash)
|
|
22
|
+
6. Stage and commit: `git add .ai/changelogs/<filename> && git commit -m "chore(ai): document commit <short-hash> [acs]"`
|
|
23
|
+
|
|
24
|
+
The `[acs]` tag in the commit message prevents the pre-commit hook from generating another changelog for this doc commit.
|
|
25
|
+
|
|
26
|
+
## Changelog Schema
|
|
27
|
+
|
|
28
|
+
```
|
|
29
|
+
# AI Changelog
|
|
30
|
+
Commit: <full commit hash>
|
|
31
|
+
Date: <ISO 8601 timestamp>
|
|
32
|
+
Author: <git author name and email>
|
|
33
|
+
Branch: <current branch>
|
|
34
|
+
AI-Tool: claude-code
|
|
35
|
+
Session-Quality: INFERRED
|
|
36
|
+
|
|
37
|
+
## What Changed
|
|
38
|
+
[Factual description of the diff. What files changed and what they do now. Never hallucinate — only describe what's in the diff. Minimum 2 sentences.]
|
|
39
|
+
|
|
40
|
+
## Why (AI Context)
|
|
41
|
+
[The reasoning behind this change. What problem it solves, what decision was made, what alternatives were considered. Minimum 2 sentences.]
|
|
42
|
+
|
|
43
|
+
## Architectural Impact
|
|
44
|
+
[What this changes about the system design. How it affects other parts of the codebase. Or "Minimal — no architectural change detected." Minimum 2 sentences.]
|
|
45
|
+
|
|
46
|
+
## Patterns Used
|
|
47
|
+
[Which patterns from CONSTITUTION.md this follows. Or "Pattern not yet established in CONSTITUTION.md." Minimum 2 sentences.]
|
|
48
|
+
|
|
49
|
+
## Integration Points
|
|
50
|
+
[What other files, services, or APIs reference or depend on what changed. Or "None detected." Minimum 2 sentences.]
|
|
51
|
+
|
|
52
|
+
## Gotchas
|
|
53
|
+
[Non-obvious things about this change that the next developer should know. Or "None identified." Minimum 2 sentences.]
|
|
54
|
+
|
|
55
|
+
## How to Extend
|
|
56
|
+
[Where the next developer should start if they need to build on this. File:line references where possible. Minimum 2 sentences.]
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
## Slash Commands
|
|
60
|
+
|
|
61
|
+
### /acs-why `<file>`
|
|
62
|
+
Explain why a file looks the way it does.
|
|
63
|
+
|
|
64
|
+
1. Run: `git log --follow --format="%H" -- <file>`
|
|
65
|
+
2. For each commit hash, run `acs find-changelog <hash>` or scan `.ai/changelogs/` for files containing `Commit: <hash>`
|
|
66
|
+
3. Read all matching changelogs
|
|
67
|
+
4. Synthesize: "Here's the history of `<file>` and the reasoning behind its current state..."
|
|
68
|
+
|
|
69
|
+
Default: show all changelogs. If there are more than ~15, summarize the oldest ones and show the 5 most recent in full.
|
|
70
|
+
|
|
71
|
+
### /acs-onboard
|
|
72
|
+
Generate a complete project briefing for a new developer or AI agent.
|
|
73
|
+
|
|
74
|
+
1. Read `.ai/CONSTITUTION.md` (full)
|
|
75
|
+
2. Read the 20 most recent changelogs from `.ai/changelogs/`
|
|
76
|
+
3. Synthesize: architecture, patterns, recent work, in-flight features, gotchas
|
|
77
|
+
|
|
78
|
+
### /acs-commit
|
|
79
|
+
Propose a conventional commit message for the current staged changes.
|
|
80
|
+
|
|
81
|
+
1. Run: `git diff --cached`
|
|
82
|
+
2. Read `.ai/CONSTITUTION.md` for naming conventions
|
|
83
|
+
3. Propose a Conventional Commits message: `type(scope): description`
|
|
84
|
+
4. Show the proposal and ask for confirmation before committing
|
|
85
|
+
|
|
86
|
+
## Enrichment (acs retry)
|
|
87
|
+
|
|
88
|
+
If `.ai/.pending-<hash>` files exist (created by `acs retry`), offer to enrich them:
|
|
89
|
+
"I see N commits with minimal changelogs. Want me to enrich them now?"
|
|
90
|
+
|
|
91
|
+
For each pending file:
|
|
92
|
+
1. Read the pending file (contains: commit hash, diff, author, branch)
|
|
93
|
+
2. Generate a full changelog using the schema above
|
|
94
|
+
3. Find the matching changelog in `.ai/changelogs/` (by Commit: field)
|
|
95
|
+
4. Overwrite it with the enriched content
|
|
96
|
+
5. Stage: `git add .ai/changelogs/<filename>`
|
|
97
|
+
|
|
98
|
+
After enriching all pending files:
|
|
99
|
+
- Delete all `.ai/.pending-*` files
|
|
100
|
+
- `git add .ai/changelogs/ && git commit -m "chore(ai): enrich N changelogs [acs]"`
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
# ACS Context — AI Context Sync
|
|
2
|
+
|
|
3
|
+
This project uses **ai-context-sync (acs)**. The `.ai/` directory is the team's shared AI memory.
|
|
4
|
+
|
|
5
|
+
## Before Starting Any Task
|
|
6
|
+
|
|
7
|
+
1. Read `.ai/CONSTITUTION.md` — project coding patterns and conventions
|
|
8
|
+
2. Read the 5 most recent files in `.ai/changelogs/` to understand recent work
|
|
9
|
+
|
|
10
|
+
## After Every Git Commit
|
|
11
|
+
|
|
12
|
+
After committing code, generate and write a changelog to `.ai/changelogs/`:
|
|
13
|
+
|
|
14
|
+
**Filename:** `changelog-<YYYY-MM-DDTHH-MM-SS>Z-<4chars>.md`
|
|
15
|
+
(Use hyphens instead of colons in the timestamp for filesystem compatibility)
|
|
16
|
+
|
|
17
|
+
**Content schema:**
|
|
18
|
+
```
|
|
19
|
+
# AI Changelog
|
|
20
|
+
Commit: <full commit hash>
|
|
21
|
+
Date: <ISO timestamp>
|
|
22
|
+
Author: <name email>
|
|
23
|
+
Branch: <branch>
|
|
24
|
+
AI-Tool: codex
|
|
25
|
+
Session-Quality: INFERRED
|
|
26
|
+
|
|
27
|
+
## What Changed
|
|
28
|
+
[2+ sentences: what files changed and what they do now]
|
|
29
|
+
|
|
30
|
+
## Why (AI Context)
|
|
31
|
+
[2+ sentences: the reasoning, decisions, alternatives considered]
|
|
32
|
+
|
|
33
|
+
## Architectural Impact
|
|
34
|
+
[2+ sentences: system design impact, or "Minimal — no architectural change."]
|
|
35
|
+
|
|
36
|
+
## Patterns Used
|
|
37
|
+
[2+ sentences: patterns from CONSTITUTION.md used, or "Pattern not yet established."]
|
|
38
|
+
|
|
39
|
+
## Integration Points
|
|
40
|
+
[2+ sentences: dependencies and callers affected, or "None detected."]
|
|
41
|
+
|
|
42
|
+
## Gotchas
|
|
43
|
+
[2+ sentences: non-obvious notes for next developer, or "None identified."]
|
|
44
|
+
|
|
45
|
+
## How to Extend
|
|
46
|
+
[2+ sentences: where to start for follow-on work]
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
After writing the file, commit it:
|
|
50
|
+
```
|
|
51
|
+
git add .ai/changelogs/<filename>
|
|
52
|
+
git commit -m "chore(ai): document commit <short-hash> [acs]"
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
The `[acs]` tag prevents the pre-commit hook from looping.
|
|
56
|
+
|
|
57
|
+
## Key Commands
|
|
58
|
+
|
|
59
|
+
- `acs why <file>` — see the history and reasoning behind a file
|
|
60
|
+
- `acs onboard` — full project briefing from accumulated context
|
|
61
|
+
- `acs status` — check for commits missing changelogs
|
|
62
|
+
- `acs retry` — enrich minimal changelogs with AI context
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# AI Context Sync (acs)
|
|
2
|
+
|
|
3
|
+
This repository uses **ai-context-sync** to maintain AI team memory in `.ai/`.
|
|
4
|
+
|
|
5
|
+
## Before Starting Any Task
|
|
6
|
+
|
|
7
|
+
1. Read `.ai/CONSTITUTION.md` — coding patterns, conventions, anti-patterns for this project
|
|
8
|
+
2. Read the 5 most recent `.ai/changelogs/` files — what changed recently and why
|
|
9
|
+
|
|
10
|
+
## After Making Commits
|
|
11
|
+
|
|
12
|
+
Write a changelog to `.ai/changelogs/changelog-<timestamp>Z-<suffix>.md` after each commit.
|
|
13
|
+
See the acs SKILL.md or `agents/acs-context.md` for the full schema.
|
|
14
|
+
|
|
15
|
+
Commit the changelog: `git add .ai/changelogs/ && git commit -m "chore(ai): document commit <hash> [acs]"`
|
|
16
|
+
|
|
17
|
+
## Key Commands
|
|
18
|
+
|
|
19
|
+
- `acs why <file>` — why does this file look like this?
|
|
20
|
+
- `acs onboard` — full project briefing
|
|
21
|
+
- `acs status` — what's missing context?
|
|
22
|
+
- `acs retry` — enrich minimal changelogs
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# AI Constitution — {{PROJECT_NAME}}
|
|
2
|
+
<!-- Managed by acs. Add new sections with: acs update-constitution -->
|
|
3
|
+
<!-- AI tools: read only the most recent section for each heading -->
|
|
4
|
+
|
|
5
|
+
## [{{DATE}}] How to Code Here
|
|
6
|
+
|
|
7
|
+
### Stack & Patterns
|
|
8
|
+
<!-- Describe the main technologies and architectural patterns used -->
|
|
9
|
+
- Language/Runtime: [e.g., TypeScript/Node.js, Python/FastAPI, Go]
|
|
10
|
+
- Key frameworks: [e.g., React, Express, Django]
|
|
11
|
+
- Testing: [e.g., Vitest for unit, Playwright for E2E]
|
|
12
|
+
|
|
13
|
+
### File Organization
|
|
14
|
+
<!-- How is code organized? What goes where? -->
|
|
15
|
+
- Source: `src/` — application code
|
|
16
|
+
- Tests: `tests/` — mirrors src/ structure
|
|
17
|
+
- [Add more conventions here]
|
|
18
|
+
|
|
19
|
+
### Naming Conventions
|
|
20
|
+
- Files: [e.g., kebab-case for modules, PascalCase for components]
|
|
21
|
+
- Functions: [e.g., camelCase, verb-first for actions]
|
|
22
|
+
- Variables: [e.g., camelCase, descriptive names preferred]
|
|
23
|
+
|
|
24
|
+
### Anti-Patterns (Never Do)
|
|
25
|
+
<!-- Things that caused bugs or were explicitly decided against -->
|
|
26
|
+
- [e.g., Don't use any — use unknown and narrow the type]
|
|
27
|
+
- [e.g., Don't commit secrets — use env vars]
|
|
28
|
+
|
|
29
|
+
### Key Entry Points
|
|
30
|
+
<!-- Where should a new developer start reading? -->
|
|
31
|
+
- [e.g., src/index.ts — CLI entry point]
|
|
32
|
+
- [e.g., src/core/ — core business logic]
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
# .aiignore — files never sent to AI for changelog generation
|
|
2
|
+
# Syntax identical to .gitignore
|
|
3
|
+
# Generated by acs init — customize as needed
|
|
4
|
+
|
|
5
|
+
# === Secrets (always redacted) ===
|
|
6
|
+
.env
|
|
7
|
+
.env.*
|
|
8
|
+
*.pem
|
|
9
|
+
*.key
|
|
10
|
+
*.p12
|
|
11
|
+
*.pfx
|
|
12
|
+
secrets/
|
|
13
|
+
credentials/
|
|
14
|
+
**/*secret*
|
|
15
|
+
**/*_secret*
|
|
16
|
+
|
|
17
|
+
# === Large generated files (too expensive to summarize) ===
|
|
18
|
+
package-lock.json
|
|
19
|
+
yarn.lock
|
|
20
|
+
pnpm-lock.yaml
|
|
21
|
+
*.lock
|
|
22
|
+
dist/
|
|
23
|
+
build/
|
|
24
|
+
.next/
|
|
25
|
+
.nuxt/
|
|
26
|
+
node_modules/
|
|
27
|
+
__pycache__/
|
|
28
|
+
*.pyc
|
|
29
|
+
.venv/
|
|
30
|
+
vendor/
|
|
31
|
+
|
|
32
|
+
# === Binary / non-text files ===
|
|
33
|
+
*.png
|
|
34
|
+
*.jpg
|
|
35
|
+
*.jpeg
|
|
36
|
+
*.gif
|
|
37
|
+
*.ico
|
|
38
|
+
*.svg
|
|
39
|
+
*.pdf
|
|
40
|
+
*.zip
|
|
41
|
+
*.tar.gz
|
|
42
|
+
*.tgz
|
|
43
|
+
*.wasm
|
|
44
|
+
*.bin
|
|
45
|
+
*.exe
|