@nolrm/contextkit 0.13.2 → 0.13.4

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 CHANGED
@@ -142,6 +142,9 @@ ContextKit installs reusable slash commands for supported platforms:
142
142
  | `/refactor` | Refactor code with safety checks |
143
143
  | `/test` | Generate comprehensive tests |
144
144
  | `/doc` | Add documentation |
145
+ | `/doc-arch` | Generate architecture docs (`docs/architecture.md`) — stack-aware (Level 1) |
146
+ | `/doc-feature` | Generate feature-level docs (`docs/features/<name>.md`) — stack-aware (Level 2) |
147
+ | `/doc-component` | Generate component-level docs colocated with the target file — stack-aware (Level 3) |
145
148
  | `/spec` | Write a component spec (MD-first) before any code is created |
146
149
  | `/squad` | Kick off a squad task — one task or many (auto-detects batch mode). Pushes back with clarifying questions if the task is vague. |
147
150
  | `/squad-architect` | Design the technical plan from the PO spec |
@@ -284,6 +287,36 @@ Hooks are optional and can be skipped with `ck install --no-hooks`.
284
287
 
285
288
  ---
286
289
 
290
+ ## CI Squad — GitHub Issues → PR
291
+
292
+ ContextKit can automatically turn GitHub issues into pull requests — no local development required.
293
+
294
+ **How it works:**
295
+
296
+ 1. Label any issue `squad-ready`
297
+ 2. GitHub Actions runs the full squad pipeline (architect → dev → test → review) using Claude
298
+ 3. A draft PR is opened, linked to the issue
299
+
300
+ **Setup:**
301
+
302
+ ```bash
303
+ ck install # answer "yes" to the CI squad prompt
304
+ ```
305
+
306
+ Then add your Anthropic API key as a repository secret:
307
+
308
+ > **Settings → Secrets and variables → Actions → New repository secret**
309
+ > Name: `ANTHROPIC_API_KEY`
310
+
311
+ **Tips:**
312
+
313
+ - Write issues with clear acceptance criteria for the best results
314
+ - If the issue is too vague, the workflow posts a comment asking for clarification instead of generating a bad PR
315
+ - PRs always open as **draft** — you review and merge manually
316
+ - Re-apply the `squad-ready` label after answering a clarification comment to re-trigger the pipeline
317
+
318
+ ---
319
+
287
320
  ## Key Features
288
321
 
289
322
  - 🧠 **Context Engineering** - Structured MD files your AI reads automatically
@@ -114,11 +114,20 @@ class InstallCommand {
114
114
  await this.gitHooksManager.installHooks(packageManager, hookChoices);
115
115
  }
116
116
 
117
+ // Ask about GitHub Actions CI squad workflow
118
+ let squadCi = false;
119
+ if (!options.nonInteractive) {
120
+ squadCi = await this.promptGitHubActionsWorkflow();
121
+ }
122
+ if (squadCi) {
123
+ await this.installGitHubActionsWorkflow();
124
+ }
125
+
117
126
  // Create configuration
118
- await this.createConfiguration(projectType, hookChoices);
127
+ await this.createConfiguration(projectType, hookChoices, squadCi);
119
128
 
120
129
  // Create status tracking
121
- await this.createStatusFile(projectType, packageManager, hookChoices);
130
+ await this.createStatusFile(projectType, packageManager, hookChoices, squadCi);
122
131
 
123
132
  // Determine which platform to install
124
133
  let chosenPlatform = requestedPlatform || null;
@@ -204,6 +213,56 @@ class InstallCommand {
204
213
  return platform;
205
214
  }
206
215
 
216
+ async promptGitHubActionsWorkflow() {
217
+ if (process.env.CI === 'true' || process.env.NON_INTERACTIVE === 'true') {
218
+ return false;
219
+ }
220
+
221
+ console.log('');
222
+ console.log('──────────────────────────────────────────────');
223
+ console.log(chalk.blue('🤖 CI Squad — GitHub Issues → PR'));
224
+ console.log('──────────────────────────────────────────────');
225
+ console.log('');
226
+ console.log(chalk.dim('Label any GitHub issue `squad-ready` and ContextKit will'));
227
+ console.log(chalk.dim('automatically create a branch, run the full squad pipeline'));
228
+ console.log(chalk.dim('(architect → dev → test → review), and open a draft PR.'));
229
+ console.log('');
230
+ console.log(chalk.dim('Requires: ANTHROPIC_API_KEY secret in your repo settings.'));
231
+ console.log('');
232
+
233
+ const { squadCi } = await inquirer.prompt([
234
+ {
235
+ type: 'confirm',
236
+ name: 'squadCi',
237
+ message: 'Install GitHub Actions workflow for issue-triggered squad automation?',
238
+ default: false,
239
+ },
240
+ ]);
241
+
242
+ if (squadCi) {
243
+ console.log(chalk.green(' ✅ CI squad workflow will be installed'));
244
+ console.log(chalk.blue(' 💡 Add ANTHROPIC_API_KEY to: Settings → Secrets → Actions'));
245
+ } else {
246
+ console.log(chalk.yellow(' ⏭️ Skipping CI squad workflow'));
247
+ }
248
+ console.log('');
249
+
250
+ return squadCi;
251
+ }
252
+
253
+ async installGitHubActionsWorkflow() {
254
+ try {
255
+ await fs.ensureDir('.github/workflows');
256
+ await this.downloadManager.downloadFile(
257
+ `${this.repoUrl}/templates/github-actions/squad-issue.yml`,
258
+ '.github/workflows/squad-issue.yml'
259
+ );
260
+ console.log(chalk.green('✅ CI squad workflow installed → .github/workflows/squad-issue.yml'));
261
+ } catch (error) {
262
+ console.log(chalk.yellow('⚠️ Could not install CI squad workflow:'), error.message);
263
+ }
264
+ }
265
+
207
266
  async promptGitHooks() {
208
267
  // Check for non-interactive mode
209
268
  if (process.env.CI === 'true' || process.env.NON_INTERACTIVE === 'true') {
@@ -738,11 +797,29 @@ Any design decisions, trade-offs, or open questions to resolve before coding.
738
797
  `${this.repoUrl}/commands/squad-doc.md`,
739
798
  '.contextkit/commands/squad-doc.md'
740
799
  );
800
+ await this.downloadManager.downloadFile(
801
+ `${this.repoUrl}/commands/squad-ci.md`,
802
+ '.contextkit/commands/squad-ci.md'
803
+ );
741
804
  await this.downloadManager.downloadFile(
742
805
  `${this.repoUrl}/commands/health-check.md`,
743
806
  '.contextkit/commands/health-check.md'
744
807
  );
745
808
 
809
+ // Download doc family commands
810
+ await this.downloadManager.downloadFile(
811
+ `${this.repoUrl}/commands/doc-arch.md`,
812
+ '.contextkit/commands/doc-arch.md'
813
+ );
814
+ await this.downloadManager.downloadFile(
815
+ `${this.repoUrl}/commands/doc-feature.md`,
816
+ '.contextkit/commands/doc-feature.md'
817
+ );
818
+ await this.downloadManager.downloadFile(
819
+ `${this.repoUrl}/commands/doc-component.md`,
820
+ '.contextkit/commands/doc-component.md'
821
+ );
822
+
746
823
  // Download hooks (pre-push and commit-msg only, no pre-commit)
747
824
  await this.downloadManager.downloadFile(
748
825
  `${this.repoUrl}/hooks/pre-push`,
@@ -948,7 +1025,7 @@ esac
948
1025
  console.log(chalk.green('✅ CLI helpers installed'));
949
1026
  }
950
1027
 
951
- async createConfiguration(projectType, hookChoices) {
1028
+ async createConfiguration(projectType, hookChoices, squadCi = false) {
952
1029
  const projectName = path.basename(process.cwd());
953
1030
 
954
1031
  const config = {
@@ -962,7 +1039,8 @@ esac
962
1039
  linting: true,
963
1040
  type_safety: true,
964
1041
  pre_push_hook: hookChoices.prePush,
965
- commit_msg_hook: hookChoices.commitMsg
1042
+ commit_msg_hook: hookChoices.commitMsg,
1043
+ squad_ci_workflow: squadCi,
966
1044
  },
967
1045
  paths: {
968
1046
  components: 'src/components',
@@ -1038,6 +1116,7 @@ features:
1038
1116
  type_safety: ${config.features.type_safety}
1039
1117
  pre_push_hook: ${config.features.pre_push_hook}
1040
1118
  commit_msg_hook: ${config.features.commit_msg_hook}
1119
+ squad_ci_workflow: ${config.features.squad_ci_workflow}
1041
1120
 
1042
1121
  # Paths (customize for your project)
1043
1122
  paths:
@@ -1078,13 +1157,14 @@ https://www.npmjs.com/package/@nolrm/contextkit
1078
1157
  await fs.writeFile('.contextkit/README.md', content);
1079
1158
  }
1080
1159
 
1081
- async createStatusFile(projectType, packageManager, hookChoices) {
1160
+ async createStatusFile(projectType, packageManager, hookChoices, squadCi = false) {
1082
1161
  try {
1083
1162
  const status = this.statusManager.getDefaultStatus();
1084
1163
  status.project_type = projectType;
1085
1164
  status.package_manager = packageManager;
1086
1165
  status.features.pre_push_hook = hookChoices.prePush;
1087
1166
  status.features.commit_msg_hook = hookChoices.commitMsg;
1167
+ status.features.squad_ci_workflow = squadCi;
1088
1168
 
1089
1169
  await this.statusManager.saveStatus(status);
1090
1170
  console.log(chalk.green('✅ Status tracking initialized'));
@@ -64,7 +64,7 @@ class UpdateCommand {
64
64
  }
65
65
 
66
66
  // Download latest files
67
- await this.downloadFiles(projectType);
67
+ await this.downloadFiles(projectType, config);
68
68
 
69
69
  // Remove files that were removed from CK
70
70
  await this.removeLegacyFiles();
@@ -205,13 +205,16 @@ class UpdateCommand {
205
205
  } else if (trimmed.startsWith('commit_msg_hook:')) {
206
206
  config.features = config.features || {};
207
207
  config.features.commit_msg_hook = trimmed.split('commit_msg_hook:')[1].trim() === 'true';
208
+ } else if (trimmed.startsWith('squad_ci_workflow:')) {
209
+ config.features = config.features || {};
210
+ config.features.squad_ci_workflow = trimmed.split('squad_ci_workflow:')[1].trim() === 'true';
208
211
  }
209
212
  }
210
213
 
211
214
  return config;
212
215
  }
213
216
 
214
- async downloadFiles(projectType) {
217
+ async downloadFiles(projectType, config = {}) {
215
218
  const spinner = ora('Downloading latest files...').start();
216
219
 
217
220
  try {
@@ -306,11 +309,38 @@ class UpdateCommand {
306
309
  `${this.repoUrl}/commands/squad-doc.md`,
307
310
  '.contextkit/commands/squad-doc.md'
308
311
  );
312
+ await this.downloadManager.downloadFile(
313
+ `${this.repoUrl}/commands/squad-ci.md`,
314
+ '.contextkit/commands/squad-ci.md'
315
+ );
309
316
  await this.downloadManager.downloadFile(
310
317
  `${this.repoUrl}/commands/health-check.md`,
311
318
  '.contextkit/commands/health-check.md'
312
319
  );
313
320
 
321
+ // Download doc family commands
322
+ await this.downloadManager.downloadFile(
323
+ `${this.repoUrl}/commands/doc-arch.md`,
324
+ '.contextkit/commands/doc-arch.md'
325
+ );
326
+ await this.downloadManager.downloadFile(
327
+ `${this.repoUrl}/commands/doc-feature.md`,
328
+ '.contextkit/commands/doc-feature.md'
329
+ );
330
+ await this.downloadManager.downloadFile(
331
+ `${this.repoUrl}/commands/doc-component.md`,
332
+ '.contextkit/commands/doc-component.md'
333
+ );
334
+
335
+ // Update CI squad workflow if the user opted in
336
+ if (config.features?.squad_ci_workflow) {
337
+ await fs.ensureDir('.github/workflows');
338
+ await this.downloadManager.downloadFile(
339
+ `${this.repoUrl}/templates/github-actions/squad-issue.yml`,
340
+ '.github/workflows/squad-issue.yml'
341
+ );
342
+ }
343
+
314
344
  // Download hooks (pre-push and commit-msg only, no pre-commit)
315
345
  await this.downloadManager.downloadFile(
316
346
  `${this.repoUrl}/hooks/pre-push`,
@@ -28,6 +28,9 @@ class ClaudeIntegration extends BaseIntegration {
28
28
  '.claude/commands/squad-doc.md',
29
29
  '.claude/commands/spec.md',
30
30
  '.claude/commands/ck.md',
31
+ '.claude/commands/doc-arch.md',
32
+ '.claude/commands/doc-feature.md',
33
+ '.claude/commands/doc-component.md',
31
34
  ];
32
35
  this.platformDir = '.claude/rules';
33
36
  }
@@ -281,6 +284,34 @@ After review passes, create or update companion .md files for every new/modified
281
284
  Read \`.contextkit/commands/health-check.md\` and execute the health check workflow.
282
285
 
283
286
  Check project setup, standards status, and integrations. Report what needs attention.
287
+ `);
288
+
289
+ // Doc family slash commands
290
+ await this.writeGeneratedFile('.claude/commands/doc-arch.md', `# Doc — Architecture (Level 1)
291
+
292
+ Read \`.contextkit/commands/doc-arch.md\` and execute the architecture documentation workflow.
293
+
294
+ Detect the project stack, then generate or update \`docs/architecture.md\` with system boundaries, key flows, and stack-appropriate artifacts (Mermaid diagrams, component trees, service maps).
295
+
296
+ Pass an optional PR number to scope to that PR's changes.
297
+ `);
298
+
299
+ await this.writeGeneratedFile('.claude/commands/doc-feature.md', `# Doc — Feature (Level 2)
300
+
301
+ Read \`.contextkit/commands/doc-feature.md\` and execute the feature documentation workflow.
302
+
303
+ Detect the project stack, identify the target feature from the argument or current branch, then generate or update \`docs/features/<name>.md\` with purpose, components/modules, data flow, and user flows.
304
+
305
+ Pass a feature name, directory path, or PR number to scope the documentation.
306
+ `);
307
+
308
+ await this.writeGeneratedFile('.claude/commands/doc-component.md', `# Doc — Component (Level 3)
309
+
310
+ Read \`.contextkit/commands/doc-component.md\` and execute the component documentation workflow.
311
+
312
+ Detect the project stack, read the target file or directory, then create or update a colocated \`<name>.md\` with API/props, usage examples, behavior, and edge cases.
313
+
314
+ Pass a file path or directory to target. Omit to infer from current context.
284
315
  `);
285
316
  }
286
317
 
@@ -296,7 +327,10 @@ Check project setup, standards status, and integrations. Report what needs atten
296
327
  console.log(chalk.dim(' /fix — Diagnose and fix a bug'));
297
328
  console.log(chalk.dim(' /refactor — Refactor code structure'));
298
329
  console.log(chalk.dim(' /test — Generate or run tests'));
299
- console.log(chalk.dim(' /doc — Add documentation'));
330
+ console.log(chalk.dim(' /doc — Add documentation'));
331
+ console.log(chalk.dim(' /doc-arch — Architecture docs (Level 1)'));
332
+ console.log(chalk.dim(' /doc-feature — Feature docs (Level 2)'));
333
+ console.log(chalk.dim(' /doc-component — Component docs (Level 3)'));
300
334
  console.log(chalk.dim(''));
301
335
  console.log(chalk.dim(' Squad (multi-agent workflow):'));
302
336
  console.log(chalk.dim(' /squad "task" — Kickoff: create handoff + PO spec'));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nolrm/contextkit",
3
- "version": "0.13.2",
3
+ "version": "0.13.4",
4
4
  "description": "ContextKit - Context Engineering for AI Development. Provide rich context to AI through structured MD files with standards, code guides, and documentation. Works with Cursor, Claude, Aider, VS Code Copilot, and more.",
5
5
  "main": "lib/index.js",
6
6
  "bin": {