azclaude-copilot 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/.claude-plugin/marketplace.json +27 -0
- package/.claude-plugin/plugin.json +17 -0
- package/LICENSE +21 -0
- package/README.md +477 -0
- package/bin/cli.js +1027 -0
- package/bin/copilot.js +228 -0
- package/hooks/README.md +3 -0
- package/hooks/hooks.json +40 -0
- package/package.json +41 -0
- package/templates/CLAUDE.md +51 -0
- package/templates/agents/cc-cli-integrator.md +104 -0
- package/templates/agents/cc-template-author.md +109 -0
- package/templates/agents/cc-test-maintainer.md +101 -0
- package/templates/agents/code-reviewer.md +136 -0
- package/templates/agents/loop-controller.md +118 -0
- package/templates/agents/orchestrator-init.md +196 -0
- package/templates/agents/test-writer.md +129 -0
- package/templates/capabilities/evolution/cycle2-knowledge.md +87 -0
- package/templates/capabilities/evolution/cycle3-topology.md +128 -0
- package/templates/capabilities/evolution/detect.md +103 -0
- package/templates/capabilities/evolution/evaluate.md +90 -0
- package/templates/capabilities/evolution/generate.md +123 -0
- package/templates/capabilities/evolution/re-derivation.md +77 -0
- package/templates/capabilities/intelligence/debate.md +104 -0
- package/templates/capabilities/intelligence/elo.md +122 -0
- package/templates/capabilities/intelligence/experiment.md +86 -0
- package/templates/capabilities/intelligence/opro.md +84 -0
- package/templates/capabilities/intelligence/pipeline.md +149 -0
- package/templates/capabilities/level-builders/level1-claudemd.md +52 -0
- package/templates/capabilities/level-builders/level2-mcp.md +58 -0
- package/templates/capabilities/level-builders/level3-skills.md +276 -0
- package/templates/capabilities/level-builders/level4-memory.md +72 -0
- package/templates/capabilities/level-builders/level5-agents.md +123 -0
- package/templates/capabilities/level-builders/level6-hooks.md +119 -0
- package/templates/capabilities/level-builders/level7-extmcp.md +60 -0
- package/templates/capabilities/level-builders/level8-orchestrated.md +98 -0
- package/templates/capabilities/manifest.md +58 -0
- package/templates/capabilities/shared/5-layer-agent.md +206 -0
- package/templates/capabilities/shared/completion-rule.md +44 -0
- package/templates/capabilities/shared/context-artifacts.md +96 -0
- package/templates/capabilities/shared/domain-advisor-generator.md +205 -0
- package/templates/capabilities/shared/friction-log.md +43 -0
- package/templates/capabilities/shared/multi-cli-paths.md +56 -0
- package/templates/capabilities/shared/native-tools.md +199 -0
- package/templates/capabilities/shared/plan-tracker.md +69 -0
- package/templates/capabilities/shared/pressure-test.md +88 -0
- package/templates/capabilities/shared/quality-check.md +83 -0
- package/templates/capabilities/shared/reflexes.md +159 -0
- package/templates/capabilities/shared/review-reception.md +70 -0
- package/templates/capabilities/shared/security.md +174 -0
- package/templates/capabilities/shared/semantic-boundary-check.md +140 -0
- package/templates/capabilities/shared/session-rhythm.md +42 -0
- package/templates/capabilities/shared/tdd.md +54 -0
- package/templates/capabilities/shared/vocabulary-transform.md +63 -0
- package/templates/commands/add.md +152 -0
- package/templates/commands/audit.md +123 -0
- package/templates/commands/blueprint.md +115 -0
- package/templates/commands/copilot.md +157 -0
- package/templates/commands/create.md +156 -0
- package/templates/commands/debate.md +75 -0
- package/templates/commands/deps.md +112 -0
- package/templates/commands/doc.md +100 -0
- package/templates/commands/dream.md +120 -0
- package/templates/commands/evolve.md +170 -0
- package/templates/commands/explain.md +25 -0
- package/templates/commands/find.md +100 -0
- package/templates/commands/fix.md +122 -0
- package/templates/commands/hookify.md +100 -0
- package/templates/commands/level-up.md +48 -0
- package/templates/commands/loop.md +62 -0
- package/templates/commands/migrate.md +119 -0
- package/templates/commands/persist.md +73 -0
- package/templates/commands/pulse.md +87 -0
- package/templates/commands/refactor.md +97 -0
- package/templates/commands/reflect.md +107 -0
- package/templates/commands/reflexes.md +141 -0
- package/templates/commands/setup.md +97 -0
- package/templates/commands/ship.md +131 -0
- package/templates/commands/snapshot.md +70 -0
- package/templates/commands/test.md +86 -0
- package/templates/hooks/post-tool-use.js +175 -0
- package/templates/hooks/stop.js +85 -0
- package/templates/hooks/user-prompt.js +96 -0
- package/templates/scripts/env-scan.sh +46 -0
- package/templates/scripts/import-graph.sh +88 -0
- package/templates/scripts/validate-boundaries.sh +180 -0
- package/templates/skills/agent-creator/SKILL.md +91 -0
- package/templates/skills/agent-creator/examples/sample-agent.md +80 -0
- package/templates/skills/agent-creator/references/agent-engineering-guide.md +596 -0
- package/templates/skills/agent-creator/references/quality-checklist.md +42 -0
- package/templates/skills/agent-creator/scripts/scaffold.sh +144 -0
- package/templates/skills/architecture-advisor/SKILL.md +92 -0
- package/templates/skills/architecture-advisor/references/database-decisions.md +61 -0
- package/templates/skills/architecture-advisor/references/decision-matrices.md +122 -0
- package/templates/skills/architecture-advisor/references/rendering-decisions.md +39 -0
- package/templates/skills/architecture-advisor/scripts/detect-scale.sh +67 -0
- package/templates/skills/debate/SKILL.md +36 -0
- package/templates/skills/debate/references/acemad-protocol.md +72 -0
- package/templates/skills/env-scanner/SKILL.md +41 -0
- package/templates/skills/security/SKILL.md +44 -0
- package/templates/skills/security/references/security-details.md +48 -0
- package/templates/skills/session-guard/SKILL.md +33 -0
- package/templates/skills/skill-creator/SKILL.md +82 -0
- package/templates/skills/skill-creator/examples/sample-skill.md +74 -0
- package/templates/skills/skill-creator/references/quality-checklist.md +36 -0
- package/templates/skills/skill-creator/references/skill-engineering-guide.md +365 -0
- package/templates/skills/skill-creator/scripts/scaffold.sh +75 -0
- package/templates/skills/test-first/SKILL.md +41 -0
package/bin/copilot.js
ADDED
|
@@ -0,0 +1,228 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
'use strict';
|
|
3
|
+
/**
|
|
4
|
+
* AZCLAUDE Copilot — Autonomous Runner
|
|
5
|
+
*
|
|
6
|
+
* The outer loop. Stateless. Dumb on purpose.
|
|
7
|
+
* Restarts Claude Code sessions until COPILOT_COMPLETE or max sessions reached.
|
|
8
|
+
* All intelligence lives inside AZCLAUDE (the inner brain).
|
|
9
|
+
*
|
|
10
|
+
* Usage:
|
|
11
|
+
* npx azclaude-copilot <project-dir> <intent> [max-sessions]
|
|
12
|
+
* npx azclaude-copilot . # resume (reads existing plan.md)
|
|
13
|
+
* npx azclaude-copilot . "Build a todo app" 20 # new project, 20 session limit
|
|
14
|
+
* npx azclaude-copilot . intent.md # intent from file
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
const fs = require('fs');
|
|
18
|
+
const path = require('path');
|
|
19
|
+
const { spawnSync } = require('child_process');
|
|
20
|
+
|
|
21
|
+
// ── Args ─────────────────────────────────────────────────────────────────────
|
|
22
|
+
|
|
23
|
+
const args = process.argv.slice(2);
|
|
24
|
+
const projectDir = path.resolve(args[0] || '.');
|
|
25
|
+
const intentArg = args[1] || '';
|
|
26
|
+
const maxSessions = parseInt(args[2] || '20', 10);
|
|
27
|
+
|
|
28
|
+
if (args.includes('--help') || args.includes('-h')) {
|
|
29
|
+
console.log(`
|
|
30
|
+
AZCLAUDE Copilot — Autonomous Product Builder
|
|
31
|
+
|
|
32
|
+
Usage:
|
|
33
|
+
npx azclaude-copilot <project-dir> <intent> [max-sessions]
|
|
34
|
+
|
|
35
|
+
Examples:
|
|
36
|
+
npx azclaude-copilot . "Build a REST API with auth"
|
|
37
|
+
npx azclaude-copilot . intent.md 30
|
|
38
|
+
npx azclaude-copilot . # resume existing project
|
|
39
|
+
|
|
40
|
+
Options:
|
|
41
|
+
--help, -h Show this help
|
|
42
|
+
max-sessions Maximum sessions before stopping (default: 20)
|
|
43
|
+
`);
|
|
44
|
+
process.exit(0);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
// ── Validate ─────────────────────────────────────────────────────────────────
|
|
48
|
+
|
|
49
|
+
if (!fs.existsSync(projectDir)) {
|
|
50
|
+
console.error(` Error: project directory "${projectDir}" does not exist.`);
|
|
51
|
+
process.exit(1);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
// Check Claude Code is available
|
|
55
|
+
try {
|
|
56
|
+
spawnSync('claude', ['--version'], { stdio: 'ignore', timeout: 3000 });
|
|
57
|
+
} catch (_) {
|
|
58
|
+
console.error(' Error: "claude" CLI not found in PATH. Install Claude Code first.');
|
|
59
|
+
process.exit(1);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
// ── Intent ───────────────────────────────────────────────────────────────────
|
|
63
|
+
|
|
64
|
+
const claudeDir = path.join(projectDir, '.claude');
|
|
65
|
+
const intentPath = path.join(claudeDir, 'copilot-intent.md');
|
|
66
|
+
const planPath = path.join(claudeDir, 'plan.md');
|
|
67
|
+
const goalsPath = path.join(claudeDir, 'memory', 'goals.md');
|
|
68
|
+
|
|
69
|
+
fs.mkdirSync(path.join(claudeDir, 'memory', 'checkpoints'), { recursive: true });
|
|
70
|
+
|
|
71
|
+
if (intentArg) {
|
|
72
|
+
// Intent provided — save it
|
|
73
|
+
let intent = intentArg;
|
|
74
|
+
if (fs.existsSync(intentArg)) {
|
|
75
|
+
// It's a file path
|
|
76
|
+
intent = fs.readFileSync(intentArg, 'utf8');
|
|
77
|
+
}
|
|
78
|
+
fs.writeFileSync(intentPath, intent);
|
|
79
|
+
} else if (!fs.existsSync(intentPath) && !fs.existsSync(planPath)) {
|
|
80
|
+
console.error(' Error: no intent provided and no existing plan.md found.');
|
|
81
|
+
console.error(' Usage: npx azclaude-copilot . "describe your product"');
|
|
82
|
+
process.exit(1);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
// ── Banner ───────────────────────────────────────────────────────────────────
|
|
86
|
+
|
|
87
|
+
const intent = fs.existsSync(intentPath) ? fs.readFileSync(intentPath, 'utf8').trim() : '(resuming)';
|
|
88
|
+
const resuming = fs.existsSync(planPath);
|
|
89
|
+
|
|
90
|
+
// ── Security: verify project directory is safe ──────────────────────────────
|
|
91
|
+
const resolvedProject = path.resolve(projectDir);
|
|
92
|
+
const homeDir = require('os').homedir();
|
|
93
|
+
if (resolvedProject === homeDir || resolvedProject === '/' || resolvedProject === 'C:\\') {
|
|
94
|
+
console.error(' Error: refusing to run copilot on home directory or root. Use a project subdirectory.');
|
|
95
|
+
process.exit(1);
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
console.log('\n════════════════════════════════════════════════');
|
|
99
|
+
console.log(' AZCLAUDE COPILOT — Autonomous Mode');
|
|
100
|
+
console.log(` Project: ${projectDir}`);
|
|
101
|
+
console.log(` Max sessions: ${maxSessions}`);
|
|
102
|
+
console.log(` Mode: ${resuming ? 'RESUME (plan.md exists)' : 'NEW (will run /blueprint)'}`);
|
|
103
|
+
console.log('');
|
|
104
|
+
console.log(' ┌─── Token Usage Alert ─────────────────────┐');
|
|
105
|
+
console.log(' │ │');
|
|
106
|
+
console.log(` │ Copilot runs ~${maxSessions} autonomous sessions. │`);
|
|
107
|
+
console.log(' │ Each session uses ~100K-300K tokens. │');
|
|
108
|
+
console.log(' │ │');
|
|
109
|
+
console.log(' │ Ensure your LLM provider has sufficient │');
|
|
110
|
+
console.log(' │ token quota before starting. │');
|
|
111
|
+
console.log(' │ │');
|
|
112
|
+
console.log(' │ Reduce sessions with: copilot . intent 5 │');
|
|
113
|
+
console.log(' └────────────────────────────────────────────┘');
|
|
114
|
+
console.log('');
|
|
115
|
+
console.log(' ⚠ Uses --dangerously-skip-permissions');
|
|
116
|
+
console.log(' ⚠ Claude has full access to this directory');
|
|
117
|
+
console.log(' ⚠ See SECURITY.md for mitigations');
|
|
118
|
+
console.log('════════════════════════════════════════════════');
|
|
119
|
+
console.log(`\n Intent: ${intent.slice(0, 120)}${intent.length > 120 ? '...' : ''}\n`);
|
|
120
|
+
|
|
121
|
+
// ── Session Loop ─────────────────────────────────────────────────────────────
|
|
122
|
+
|
|
123
|
+
const sessionStartTimes = [];
|
|
124
|
+
|
|
125
|
+
for (let session = 1; session <= maxSessions; session++) {
|
|
126
|
+
const sessionStart = Date.now();
|
|
127
|
+
sessionStartTimes.push(sessionStart);
|
|
128
|
+
const elapsed = sessionStartTimes.length > 1
|
|
129
|
+
? Math.round((sessionStart - sessionStartTimes[0]) / 60000)
|
|
130
|
+
: 0;
|
|
131
|
+
console.log(`\n── Session ${session}/${maxSessions} ${elapsed > 0 ? `(${elapsed}min elapsed)` : ''} ──`);
|
|
132
|
+
|
|
133
|
+
// Build state-aware prompt
|
|
134
|
+
let prompt = 'You are in AZCLAUDE Copilot mode. Run /copilot to continue autonomous building.';
|
|
135
|
+
prompt += `\n\nOriginal intent: ${intent}`;
|
|
136
|
+
prompt += `\n\nSession ${session}/${maxSessions}.`;
|
|
137
|
+
|
|
138
|
+
if (resuming || session > 1) {
|
|
139
|
+
// Parse plan.md for milestone progress
|
|
140
|
+
if (fs.existsSync(planPath)) {
|
|
141
|
+
const planContent = fs.readFileSync(planPath, 'utf8');
|
|
142
|
+
const statuses = [...planContent.matchAll(/^- Status: (\w+)/gm)].map(m => m[1]);
|
|
143
|
+
const done = statuses.filter(s => s === 'done').length;
|
|
144
|
+
const blocked = statuses.filter(s => s === 'blocked').length;
|
|
145
|
+
const pending = statuses.filter(s => s === 'pending' || s === 'in-progress').length;
|
|
146
|
+
const total = statuses.length;
|
|
147
|
+
prompt += `\n\nPlan progress: ${done}/${total} done, ${blocked} blocked, ${pending} remaining.`;
|
|
148
|
+
if (blocked > 0) prompt += ' Check blockers.md — retry blocked milestones if new context helps.';
|
|
149
|
+
if (done > 0 && done % 3 === 0) prompt += ' 3+ milestones since last /evolve — run /reflexes analyze + /evolve.';
|
|
150
|
+
if (pending === 0 && blocked === 0) prompt += ' All milestones done — run /audit then /ship.';
|
|
151
|
+
} else {
|
|
152
|
+
prompt += '\n\nPlan exists but plan.md not found. Read .claude/plan.md for status.';
|
|
153
|
+
}
|
|
154
|
+
} else {
|
|
155
|
+
prompt += '\n\nNo plan yet. Start with /setup then /blueprint to create milestones.';
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
// Run Claude Code session
|
|
159
|
+
const result = spawnSync('claude', [
|
|
160
|
+
'--dangerously-skip-permissions',
|
|
161
|
+
'-p', prompt,
|
|
162
|
+
'--output-format', 'text'
|
|
163
|
+
], {
|
|
164
|
+
cwd: projectDir,
|
|
165
|
+
stdio: 'inherit',
|
|
166
|
+
timeout: 1800000, // 30 minutes per session (large milestones need time)
|
|
167
|
+
});
|
|
168
|
+
|
|
169
|
+
if (result.error) {
|
|
170
|
+
console.error(` Session ${session} error: ${result.error.message}`);
|
|
171
|
+
if (result.error.code === 'ETIMEDOUT') {
|
|
172
|
+
console.log(' Session timed out (30 min). Restarting...');
|
|
173
|
+
continue;
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
// Check completion
|
|
178
|
+
if (fs.existsSync(goalsPath)) {
|
|
179
|
+
const goals = fs.readFileSync(goalsPath, 'utf8');
|
|
180
|
+
if (goals.includes('COPILOT_COMPLETE')) {
|
|
181
|
+
console.log('\n════════════════════════════════════════════════');
|
|
182
|
+
const totalMin = Math.round((Date.now() - sessionStartTimes[0]) / 60000);
|
|
183
|
+
console.log(' COPILOT COMPLETE');
|
|
184
|
+
console.log(` Sessions used: ${session}`);
|
|
185
|
+
console.log(` Total time: ${totalMin} minutes`);
|
|
186
|
+
const reportPath = path.join(claudeDir, 'copilot-report.md');
|
|
187
|
+
if (fs.existsSync(reportPath)) {
|
|
188
|
+
console.log(` Report: ${reportPath}`);
|
|
189
|
+
}
|
|
190
|
+
console.log('════════════════════════════════════════════════\n');
|
|
191
|
+
process.exit(0);
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
// Check if plan.md shows all done or all blocked
|
|
196
|
+
if (fs.existsSync(planPath)) {
|
|
197
|
+
const plan = fs.readFileSync(planPath, 'utf8');
|
|
198
|
+
const statuses = [...plan.matchAll(/^- Status: (\w+)/gm)].map(m => m[1]);
|
|
199
|
+
if (statuses.length > 0) {
|
|
200
|
+
const allDoneOrBlocked = statuses.every(s => s === 'done' || s === 'blocked' || s === 'skipped');
|
|
201
|
+
const allBlocked = statuses.every(s => s === 'blocked');
|
|
202
|
+
if (allBlocked) {
|
|
203
|
+
console.log('\n════════════════════════════════════════════════');
|
|
204
|
+
console.log(' ALL MILESTONES BLOCKED');
|
|
205
|
+
console.log(' Human intervention needed.');
|
|
206
|
+
console.log(` See: ${path.join(claudeDir, 'memory', 'blockers.md')}`);
|
|
207
|
+
console.log('════════════════════════════════════════════════\n');
|
|
208
|
+
process.exit(1);
|
|
209
|
+
}
|
|
210
|
+
if (allDoneOrBlocked) {
|
|
211
|
+
console.log(' All milestones resolved. Next session should finalize.');
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
console.log(` Session ${session} ended. State preserved. Continuing...`);
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
// ── Max sessions reached ─────────────────────────────────────────────────────
|
|
220
|
+
|
|
221
|
+
const totalMinMax = Math.round((Date.now() - sessionStartTimes[0]) / 60000);
|
|
222
|
+
console.log('\n════════════════════════════════════════════════');
|
|
223
|
+
console.log(` MAX SESSIONS REACHED (${maxSessions})`);
|
|
224
|
+
console.log(` Total time: ${totalMinMax} minutes`);
|
|
225
|
+
console.log(' Project not yet complete.');
|
|
226
|
+
console.log(' Resume: npx azclaude-copilot .');
|
|
227
|
+
console.log('════════════════════════════════════════════════\n');
|
|
228
|
+
process.exit(1);
|
package/hooks/README.md
ADDED
package/hooks/hooks.json
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
{
|
|
2
|
+
"hooks": {
|
|
3
|
+
"UserPromptSubmit": [
|
|
4
|
+
{
|
|
5
|
+
"matcher": "",
|
|
6
|
+
"hooks": [
|
|
7
|
+
{
|
|
8
|
+
"type": "command",
|
|
9
|
+
"command": "node \"${CLAUDE_PLUGIN_ROOT}/templates/hooks/user-prompt.js\"",
|
|
10
|
+
"async": false
|
|
11
|
+
}
|
|
12
|
+
]
|
|
13
|
+
}
|
|
14
|
+
],
|
|
15
|
+
"PostToolUse": [
|
|
16
|
+
{
|
|
17
|
+
"matcher": "Write|Edit",
|
|
18
|
+
"hooks": [
|
|
19
|
+
{
|
|
20
|
+
"type": "command",
|
|
21
|
+
"command": "node \"${CLAUDE_PLUGIN_ROOT}/templates/hooks/post-tool-use.js\"",
|
|
22
|
+
"async": true
|
|
23
|
+
}
|
|
24
|
+
]
|
|
25
|
+
}
|
|
26
|
+
],
|
|
27
|
+
"Stop": [
|
|
28
|
+
{
|
|
29
|
+
"matcher": "",
|
|
30
|
+
"hooks": [
|
|
31
|
+
{
|
|
32
|
+
"type": "command",
|
|
33
|
+
"command": "node \"${CLAUDE_PLUGIN_ROOT}/templates/hooks/stop.js\"",
|
|
34
|
+
"async": true
|
|
35
|
+
}
|
|
36
|
+
]
|
|
37
|
+
}
|
|
38
|
+
]
|
|
39
|
+
}
|
|
40
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "azclaude-copilot",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Autonomous product builder. Describe once, AZCLAUDE builds it across sessions — planning, implementing, testing, evolving, deploying. Zero human input.",
|
|
5
|
+
"bin": {
|
|
6
|
+
"azclaude": "./bin/cli.js",
|
|
7
|
+
"azclaude-copilot": "./bin/copilot.js"
|
|
8
|
+
},
|
|
9
|
+
"keywords": [
|
|
10
|
+
"claude",
|
|
11
|
+
"claude-code",
|
|
12
|
+
"ai",
|
|
13
|
+
"autonomous",
|
|
14
|
+
"copilot",
|
|
15
|
+
"developer-tools",
|
|
16
|
+
"automation",
|
|
17
|
+
"context-engineering"
|
|
18
|
+
],
|
|
19
|
+
"repository": {
|
|
20
|
+
"type": "git",
|
|
21
|
+
"url": "https://github.com/haytamAroui/AZ-CLAUDE-COPILOT.git"
|
|
22
|
+
},
|
|
23
|
+
"homepage": "https://github.com/haytamAroui/AZ-CLAUDE-COPILOT#readme",
|
|
24
|
+
"bugs": {
|
|
25
|
+
"url": "https://github.com/haytamAroui/AZ-CLAUDE-COPILOT/issues"
|
|
26
|
+
},
|
|
27
|
+
"scripts": {
|
|
28
|
+
"test:node": "node --test tests/node-smoke.test.js"
|
|
29
|
+
},
|
|
30
|
+
"author": "haytamAroui",
|
|
31
|
+
"license": "MIT",
|
|
32
|
+
"engines": {
|
|
33
|
+
"node": ">=16"
|
|
34
|
+
},
|
|
35
|
+
"files": [
|
|
36
|
+
"bin/",
|
|
37
|
+
"templates/",
|
|
38
|
+
".claude-plugin/",
|
|
39
|
+
"hooks/"
|
|
40
|
+
]
|
|
41
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
# {{PROJECT_NAME}}
|
|
2
|
+
|
|
3
|
+
## Quick Start
|
|
4
|
+
1. Run `/setup` — scans this project, fills in the sections below, creates `goals.md`
|
|
5
|
+
2. Run `/pulse` — shows current state of the project
|
|
6
|
+
3. Run `/add [what to build]` to add features, `/fix [what's broken]` to fix bugs
|
|
7
|
+
4. Run `/persist` before closing — saves session state so next session picks up where you left off
|
|
8
|
+
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
## Identity
|
|
12
|
+
{{PROJECT_DESCRIPTION}}
|
|
13
|
+
Domain: {{DOMAIN}} | Stack: {{STACK}} | Scale: {{SCALE}}
|
|
14
|
+
|
|
15
|
+
## Rules
|
|
16
|
+
1. **Completion** — Never say "should work" or "probably passes." Show the output or stay in progress.
|
|
17
|
+
2. **Precision** — Reference code as `file:line`. Never describe in prose.
|
|
18
|
+
{{TDD_RULE}}
|
|
19
|
+
|
|
20
|
+
## Session State
|
|
21
|
+
Read `.claude/memory/goals.md` at the start of every session.
|
|
22
|
+
If it does not exist, create it with empty sections.
|
|
23
|
+
Update it at the end of every session.
|
|
24
|
+
|
|
25
|
+
## Task Routing
|
|
26
|
+
Read `.claude/capabilities/manifest.md` to find what to load.
|
|
27
|
+
Load ONLY the files relevant to the current task — nothing else.
|
|
28
|
+
|
|
29
|
+
Quick dispatch (core — used most sessions):
|
|
30
|
+
- /add → commands/add.md · /fix → commands/fix.md · /test → commands/test.md
|
|
31
|
+
- /audit → commands/audit.md · /blueprint → commands/blueprint.md · /ship → commands/ship.md
|
|
32
|
+
- /pulse → commands/pulse.md · /explain → commands/explain.md
|
|
33
|
+
- Any code task → shared/tdd.md + shared/completion-rule.md
|
|
34
|
+
|
|
35
|
+
Extended (load command file on use):
|
|
36
|
+
- /setup · /dream · /snapshot · /persist · /refactor · /doc · /loop
|
|
37
|
+
- /migrate · /deps · /find · /create · /reflect · /hookify
|
|
38
|
+
|
|
39
|
+
Advanced (Level 5+):
|
|
40
|
+
- /evolve · /debate · /level-up
|
|
41
|
+
|
|
42
|
+
Unknown capability → grep manifest.md by description, load match
|
|
43
|
+
|
|
44
|
+
## Trade-Off Hierarchies
|
|
45
|
+
When priorities conflict:
|
|
46
|
+
1. {{PRIORITY_1}}
|
|
47
|
+
2. {{PRIORITY_2}}
|
|
48
|
+
3. {{PRIORITY_3}}
|
|
49
|
+
|
|
50
|
+
## Available Commands
|
|
51
|
+
/dream · /setup · /fix · /add · /audit · /test · /blueprint · /evolve · /debate · /snapshot · /persist · /level-up · /ship · /pulse · /explain · /loop · /refactor · /doc · /migrate · /deps · /find · /create · /reflect · /hookify
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: cc-cli-integrator
|
|
3
|
+
description: >
|
|
4
|
+
CLI integration specialist for bin/cli.js and bin/copilot.js.
|
|
5
|
+
Use when: adding a command to CLI routing, wiring copilot runner,
|
|
6
|
+
updating COMMANDS arrays, adding case statements, modifying copilot.js
|
|
7
|
+
session loop, changing argument parsing, updating CLI banner, fixing
|
|
8
|
+
CLI bugs, adding new CLI subcommands, modifying hook installation,
|
|
9
|
+
changing capability/skill/agent install functions, updating doctor checks.
|
|
10
|
+
model: sonnet
|
|
11
|
+
tools: [Read, Write, Edit, Glob, Grep, Bash]
|
|
12
|
+
disallowedTools: [Agent]
|
|
13
|
+
permissionMode: acceptEdits
|
|
14
|
+
maxTurns: 40
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
## Layer 1: PERSONA
|
|
18
|
+
|
|
19
|
+
CLI integration specialist. Wires new commands and features into the AZCLAUDE
|
|
20
|
+
CLI toolchain (`bin/cli.js`, `bin/copilot.js`). Ensures new template commands
|
|
21
|
+
are routable, new agents are installable, and the copilot runner handles all
|
|
22
|
+
edge cases.
|
|
23
|
+
|
|
24
|
+
## Layer 2: SCOPE
|
|
25
|
+
|
|
26
|
+
**Does:**
|
|
27
|
+
- Adds commands to `CORE_COMMANDS`, `EXTENDED_COMMANDS`, or `ADVANCED_COMMANDS` in `bin/cli.js`
|
|
28
|
+
- Adds new agents to the `AGENTS` array in `bin/cli.js`
|
|
29
|
+
- Adds new skills to the `SKILLS` array in `bin/cli.js`
|
|
30
|
+
- Wires CLI routing (`case 'copilot':` etc.) in `bin/cli.js`
|
|
31
|
+
- Modifies `bin/copilot.js` session loop logic
|
|
32
|
+
- Updates argument parsing, validation, help text
|
|
33
|
+
- Updates `installAgents()`, `installCommands()`, `installSkills()` if structure changes
|
|
34
|
+
- Runs `bash tests/test-features.sh` after every change
|
|
35
|
+
|
|
36
|
+
**Does NOT:**
|
|
37
|
+
- Write template content (that's cc-template-author's job)
|
|
38
|
+
- Write test assertions (that's cc-test-maintainer's job)
|
|
39
|
+
- Modify hook scripts (`templates/hooks/`)
|
|
40
|
+
- Change the CLAUDE.md template
|
|
41
|
+
|
|
42
|
+
## Layer 3: TOOLS & RESOURCES
|
|
43
|
+
|
|
44
|
+
```
|
|
45
|
+
Read — read bin/cli.js, bin/copilot.js, package.json
|
|
46
|
+
Edit — modify CLI files (prefer Edit over Write for existing files)
|
|
47
|
+
Glob — find related files
|
|
48
|
+
Grep — search for command references, routing patterns
|
|
49
|
+
Bash — run tests, verify CLI behavior
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
**Files to read first:**
|
|
53
|
+
1. `bin/cli.js` — main CLI with all install/routing logic
|
|
54
|
+
2. `bin/copilot.js` — copilot runner (Ralph loop)
|
|
55
|
+
3. `package.json` — bin entries, version
|
|
56
|
+
4. `ROADMAP.md` — what CLI changes are needed
|
|
57
|
+
|
|
58
|
+
## Layer 4: CONSTRAINTS
|
|
59
|
+
|
|
60
|
+
- `bin/copilot.js` must be pure Node.js — no bash, no shell scripts
|
|
61
|
+
- No `execSync('bash ...')` in copilot.js — use `spawnSync` with Node.js
|
|
62
|
+
- New commands go in the correct tier: CORE (daily use), EXTENDED (occasional), ADVANCED (Level 5+)
|
|
63
|
+
- CLI must work on Windows, macOS, Linux — no platform-specific code
|
|
64
|
+
- `--dangerously-skip-permissions` in copilot.js is a known security concern — do not remove without replacement
|
|
65
|
+
- Always use `atomicWriteFileSync` for settings files
|
|
66
|
+
- Keep `process.execPath` for Node binary reference (not hardcoded `node`)
|
|
67
|
+
|
|
68
|
+
```
|
|
69
|
+
Bad: execSync('bash copilot.sh', { stdio: 'inherit' })
|
|
70
|
+
Good: spawnSync(process.execPath, [copilotScript, ...args], { stdio: 'inherit' })
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
## Layer 5: DOMAIN CONTEXT
|
|
74
|
+
|
|
75
|
+
**CLI architecture:**
|
|
76
|
+
```
|
|
77
|
+
bin/cli.js — installer + doctor + demo + copilot delegation
|
|
78
|
+
bin/copilot.js — autonomous runner (stateless loop)
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
**Command arrays in cli.js:**
|
|
82
|
+
```javascript
|
|
83
|
+
CORE_COMMANDS = ['setup', 'fix', 'add', 'review', 'test', 'plan', 'ship', 'status', 'explain', 'checkpoint', 'persist']
|
|
84
|
+
EXTENDED_COMMANDS = ['dream', 'refactor', 'doc', 'loop', 'migrate', 'deps', 'find', 'create', 'reflect', 'hookify']
|
|
85
|
+
ADVANCED_COMMANDS = ['evolve', 'debate', 'level-up', 'copilot']
|
|
86
|
+
AGENTS = ['orchestrator-init', 'code-reviewer', 'test-writer']
|
|
87
|
+
SKILLS = ['session-guard', 'test-first', 'env-scanner', 'debate', 'security', 'skill-creator', 'agent-creator']
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
**copilot.js flow:**
|
|
91
|
+
1. Parse args (project-dir, intent, max-sessions)
|
|
92
|
+
2. Save intent to `.claude/copilot-intent.md`
|
|
93
|
+
3. Loop: spawn `claude -p` with prompt → check COPILOT_COMPLETE → repeat
|
|
94
|
+
4. Exit 0 on complete, exit 1 on max sessions or all blocked
|
|
95
|
+
|
|
96
|
+
**When adding a new agent to AGENTS array:**
|
|
97
|
+
The `installAgents()` function copies from `templates/agents/{name}.md` to
|
|
98
|
+
`{project}/.claude/agents/{name}.md` with path substitution.
|
|
99
|
+
|
|
100
|
+
## Self-Correction
|
|
101
|
+
|
|
102
|
+
If CLI changes break tests: read the failing test assertion, compare with
|
|
103
|
+
the actual CLI code, fix the mismatch.
|
|
104
|
+
After 2 attempts: stop and report the test expectation vs actual behavior.
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: cc-template-author
|
|
3
|
+
description: >
|
|
4
|
+
Template authoring specialist for AZCLAUDE command and capability markdown files.
|
|
5
|
+
Use when: creating a new command, writing a capability, editing copilot.md,
|
|
6
|
+
writing plan-tracker.md, adding any file to templates/commands/ or
|
|
7
|
+
templates/capabilities/, updating frontmatter, structuring decision logic,
|
|
8
|
+
writing milestone protocols, adding state file references, building copilot
|
|
9
|
+
report format, writing blocker handling logic, creating any .md template.
|
|
10
|
+
model: sonnet
|
|
11
|
+
tools: [Read, Write, Edit, Glob, Grep, Bash]
|
|
12
|
+
disallowedTools: [Agent]
|
|
13
|
+
permissionMode: acceptEdits
|
|
14
|
+
maxTurns: 40
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
## Layer 1: PERSONA
|
|
18
|
+
|
|
19
|
+
Template author for AZCLAUDE Copilot. Writes precise, machine-readable markdown
|
|
20
|
+
templates that Claude Code will follow as instructions. Every template must be
|
|
21
|
+
unambiguous — Claude is the consumer, not a human skimming docs.
|
|
22
|
+
|
|
23
|
+
## Layer 2: SCOPE
|
|
24
|
+
|
|
25
|
+
**Does:**
|
|
26
|
+
- Creates new command files in `templates/commands/`
|
|
27
|
+
- Creates new capability files in `templates/capabilities/shared/`
|
|
28
|
+
- Edits existing templates for structured output (plan.md format, blocker format)
|
|
29
|
+
- Adds frontmatter with correct fields (description is mandatory)
|
|
30
|
+
- Writes decision logic trees, step-by-step protocols, output formats
|
|
31
|
+
- References state files correctly (.claude/plan.md, .claude/memory/goals.md, etc.)
|
|
32
|
+
- Updates `templates/capabilities/manifest.md` when adding capabilities
|
|
33
|
+
- Runs `bash tests/test-features.sh` after every change
|
|
34
|
+
|
|
35
|
+
**Does NOT:**
|
|
36
|
+
- Modify `bin/cli.js` or `bin/copilot.js` (that's cc-cli-integrator's job)
|
|
37
|
+
- Write tests in `tests/test-features.sh` (that's cc-test-maintainer's job)
|
|
38
|
+
- Create agent definitions (use agent-creator skill instead)
|
|
39
|
+
- Over-engineer templates — instructions for Claude, not documentation for humans
|
|
40
|
+
|
|
41
|
+
## Layer 3: TOOLS & RESOURCES
|
|
42
|
+
|
|
43
|
+
```
|
|
44
|
+
Read — read existing templates for format consistency
|
|
45
|
+
Write — create new template files
|
|
46
|
+
Edit — modify existing templates
|
|
47
|
+
Glob — find template files by pattern
|
|
48
|
+
Grep — search for references, state file paths, command names
|
|
49
|
+
Bash — run tests/test-features.sh to validate changes
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
**Files to read first:**
|
|
53
|
+
1. `CLAUDE.md` — project rules and structure
|
|
54
|
+
2. `ROADMAP.md` — what needs to be built and why
|
|
55
|
+
3. `templates/commands/copilot.md` — the copilot command (reference format)
|
|
56
|
+
4. `templates/capabilities/manifest.md` — capability index
|
|
57
|
+
5. Existing template in same directory — match format
|
|
58
|
+
|
|
59
|
+
## Layer 4: CONSTRAINTS
|
|
60
|
+
|
|
61
|
+
- Every template starts with frontmatter (`---` block with at minimum `description`)
|
|
62
|
+
- Commands use step-by-step structure with `## Step N:` headers
|
|
63
|
+
- Capabilities use bullet-point rules, not prose
|
|
64
|
+
- State file paths always use `.claude/` prefix (substituted at install time)
|
|
65
|
+
- Status values in plan tracking: `pending`, `in-progress`, `done`, `blocked`, `skipped`
|
|
66
|
+
- Every template references concrete file paths, not vague descriptions
|
|
67
|
+
- Run `bash tests/test-features.sh` after every template change — do not skip
|
|
68
|
+
|
|
69
|
+
```
|
|
70
|
+
Bad: "Read the project state and decide what to do"
|
|
71
|
+
Good: "Read `.claude/plan.md` → find first milestone with `Status: pending` → implement it"
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
## Layer 5: DOMAIN CONTEXT
|
|
75
|
+
|
|
76
|
+
This is AZCLAUDE Copilot — an autonomous product builder. Templates are instructions
|
|
77
|
+
that Claude Code follows during autonomous sessions (no human in the loop).
|
|
78
|
+
|
|
79
|
+
**State files the copilot reads/writes:**
|
|
80
|
+
| File | Purpose |
|
|
81
|
+
|------|---------|
|
|
82
|
+
| `.claude/copilot-intent.md` | Original product description |
|
|
83
|
+
| `.claude/plan.md` | Milestone tracker with status per milestone |
|
|
84
|
+
| `.claude/memory/goals.md` | Session state, file breadcrumbs |
|
|
85
|
+
| `.claude/memory/checkpoints/*` | Reasoning snapshots |
|
|
86
|
+
| `.claude/memory/blockers.md` | What's stuck and why |
|
|
87
|
+
| `.claude/memory/patterns.md` | Learned conventions |
|
|
88
|
+
| `.claude/memory/decisions.md` | Architecture choices |
|
|
89
|
+
| `.claude/copilot-report.md` | Final summary when complete |
|
|
90
|
+
|
|
91
|
+
**Milestone format (plan.md):**
|
|
92
|
+
```
|
|
93
|
+
### M{N}: {title}
|
|
94
|
+
- Status: pending|in-progress|done|blocked|skipped
|
|
95
|
+
- Depends: M{X} (optional)
|
|
96
|
+
- Files: {expected files}
|
|
97
|
+
- Commit: {type}: {what}
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
**Key signals:**
|
|
101
|
+
- `COPILOT_COMPLETE` in goals.md = runner exits with success
|
|
102
|
+
- Blockers log: milestone + error + attempts + context
|
|
103
|
+
- Every 3 milestones → trigger /evolve
|
|
104
|
+
|
|
105
|
+
## Self-Correction
|
|
106
|
+
|
|
107
|
+
If tests fail after template change: re-read the test expectations from
|
|
108
|
+
`tests/test-features.sh`, fix the template to match, re-run.
|
|
109
|
+
After 2 attempts: stop and report what the test expects vs what the template has.
|