create-claude-rails 0.1.0 → 0.1.2

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/lib/cli.js CHANGED
@@ -221,8 +221,13 @@ async function run() {
221
221
  selectedModules = Object.keys(MODULES);
222
222
  if (flags.noDb) {
223
223
  includeDb = false;
224
+ // work-tracking templates are still copied (pib-db.js, schema) but
225
+ // the DB isn't initialized. Mark it as skipped so /onboard knows
226
+ // to ask about the alternative work tracking system.
227
+ selectedModules = selectedModules.filter(m => m !== 'work-tracking');
228
+ skippedModules['work-tracking'] = 'Database setup skipped (--no-db)';
224
229
  }
225
- console.log(` Installing all ${selectedModules.length} modules.${flags.noDb ? ' (skipping DB)' : ''}\n`);
230
+ console.log(` Installing all ${selectedModules.length} modules.${flags.noDb ? ' (skipping work-tracking DB)' : ''}\n`);
226
231
  } else {
227
232
  const { installAll } = await prompts({
228
233
  type: 'confirm',
@@ -306,7 +311,15 @@ async function run() {
306
311
 
307
312
  const stat = fs.statSync(srcPath);
308
313
  if (stat.isDirectory()) {
309
- const results = await copyTemplates(srcPath, destPath, { dryRun: flags.dryRun });
314
+ // For skill directories, skip phases/ absent phase files use
315
+ // skeleton defaults. Phase files are created by /onboard based
316
+ // on the project interview, not copied as generic templates.
317
+ const isSkill = tmpl.startsWith('skills/') && !tmpl.startsWith('skills/perspectives');
318
+ const results = await copyTemplates(srcPath, destPath, {
319
+ dryRun: flags.dryRun,
320
+ skipConflicts: flags.yes,
321
+ skipPhases: isSkill,
322
+ });
310
323
  totalCopied += results.copied.length;
311
324
  totalSkipped += results.skipped.length;
312
325
  totalOverwritten += results.overwritten.length;
package/lib/copy.js CHANGED
@@ -6,13 +6,13 @@ const prompts = require('prompts');
6
6
  * Recursively copy files from src to dest, surfacing conflicts.
7
7
  * Returns { copied: string[], skipped: string[], overwritten: string[] }
8
8
  */
9
- async function copyTemplates(src, dest, { dryRun = false } = {}) {
9
+ async function copyTemplates(src, dest, { dryRun = false, skipConflicts = false, skipPhases = false } = {}) {
10
10
  const results = { copied: [], skipped: [], overwritten: [] };
11
- await walkAndCopy(src, dest, src, results, dryRun);
11
+ await walkAndCopy(src, dest, src, results, dryRun, skipConflicts, skipPhases);
12
12
  return results;
13
13
  }
14
14
 
15
- async function walkAndCopy(srcRoot, destRoot, currentSrc, results, dryRun) {
15
+ async function walkAndCopy(srcRoot, destRoot, currentSrc, results, dryRun, skipConflicts, skipPhases) {
16
16
  const entries = fs.readdirSync(currentSrc, { withFileTypes: true });
17
17
 
18
18
  for (const entry of entries) {
@@ -21,10 +21,16 @@ async function walkAndCopy(srcRoot, destRoot, currentSrc, results, dryRun) {
21
21
  const destPath = path.join(destRoot, relPath);
22
22
 
23
23
  if (entry.isDirectory()) {
24
+ // Skip phases/ directories — absent phase files use skeleton defaults,
25
+ // which is the correct behavior for most adopters. Phase files are
26
+ // only created when the user customizes behavior via /onboard.
27
+ if (skipPhases && entry.name === 'phases') {
28
+ continue;
29
+ }
24
30
  if (!dryRun && !fs.existsSync(destPath)) {
25
31
  fs.mkdirSync(destPath, { recursive: true });
26
32
  }
27
- await walkAndCopy(srcRoot, destRoot, srcPath, results, dryRun);
33
+ await walkAndCopy(srcRoot, destRoot, srcPath, results, dryRun, skipConflicts, skipPhases);
28
34
  } else {
29
35
  if (fs.existsSync(destPath)) {
30
36
  const existing = fs.readFileSync(destPath, 'utf8');
@@ -35,6 +41,11 @@ async function walkAndCopy(srcRoot, destRoot, currentSrc, results, dryRun) {
35
41
  continue;
36
42
  }
37
43
 
44
+ if (skipConflicts) {
45
+ results.skipped.push(relPath);
46
+ continue;
47
+ }
48
+
38
49
  const response = await prompts({
39
50
  type: 'select',
40
51
  name: 'action',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-claude-rails",
3
- "version": "0.1.0",
3
+ "version": "0.1.2",
4
4
  "description": "Claude on Rails — opinionated process scaffolding for Claude Code projects",
5
5
  "bin": {
6
6
  "create-claude-rails": "bin/create-claude-rails.js"
@@ -24,6 +24,9 @@ related:
24
24
  - type: file
25
25
  path: .claude/skills/onboard/phases/summary.md
26
26
  role: "Present what was generated/changed"
27
+ - type: file
28
+ path: .claude/skills/onboard/phases/post-onboard-audit.md
29
+ role: "Configuration sanity check after generation"
27
30
  ---
28
31
 
29
32
  # /onboard — Project Onboarding Interview
@@ -218,6 +221,21 @@ through use as orient and debrief reveal what's missing.
218
221
  In re-run mode, present a before/after view: what the context layer
219
222
  looked like before, what changed, and why.
220
223
 
224
+ ### 7. Post-Onboard Audit
225
+
226
+ Read `phases/post-onboard-audit.md` for the configuration sanity check.
227
+
228
+ **Default (absent/empty):** Run a lightweight audit from the box-health
229
+ perspective, scoped to what was just generated. Checks interview–config
230
+ coherence (did mentioned technologies get wired into phase files?),
231
+ module–phase alignment (do phase files reference skipped modules?),
232
+ structural basics (do referenced files exist?), and first-session
233
+ readiness (will orient work on its first run?).
234
+
235
+ If everything checks out, one line: "Configuration looks clean." If
236
+ issues are found, present them and offer to fix immediately. This is a
237
+ pre-flight check, not a deferred finding.
238
+
221
239
  ## Phase Summary
222
240
 
223
241
  | Phase | Absent = | What it customizes |
@@ -228,6 +246,7 @@ looked like before, what changed, and why.
228
246
  | `generate-session-loop.md` | Default: wire orient/debrief phases | How to set up the session loop |
229
247
  | `modularity-menu.md` | Default: present module hierarchy | Which modules to present and how |
230
248
  | `summary.md` | Default: present changes + next steps | How to present results |
249
+ | `post-onboard-audit.md` | Default: box-health sanity check | What to verify after generation |
231
250
 
232
251
  ## Conversational Stance
233
252
 
@@ -9,6 +9,20 @@ standard PIB artifact set, classify each artifact's richness, and
9
9
  determine the mode. To explicitly skip state detection (force first-run
10
10
  mode), write only `skip: true`.
11
11
 
12
+ ## Pre-Check: CLI Metadata
13
+
14
+ Before scanning artifacts, read `.pibrc.json` at the project root. This
15
+ file is created by `npx create-claude-rails` and records which modules
16
+ were installed, which were skipped (with reasons), and the package version.
17
+
18
+ If `.pibrc.json` is absent, this skill was installed manually (not via
19
+ the CLI). That's fine — proceed with the artifact scan. The interview
20
+ and modularity menu will handle module decisions.
21
+
22
+ If `.pibrc.json` exists, note the installed and skipped modules. The
23
+ interview phase uses this to skip redundant questions and the modularity
24
+ menu uses `skipped` reasons to ask about alternatives.
25
+
12
26
  ## What to Scan
13
27
 
14
28
  Check for these artifacts and classify each as absent, empty, or populated:
@@ -9,6 +9,41 @@ adapted questions as described below, 2-3 at a time, with follow-ups.
9
9
  To explicitly skip the interview (e.g., when generating context from
10
10
  existing documentation), write only `skip: true`.
11
11
 
12
+ ## System Introduction (First Run Only)
13
+
14
+ Before asking about the project, check: does the user know what Claude
15
+ on Rails does? Ask once:
16
+
17
+ > "Have you used Claude on Rails before, or is this your first time?"
18
+
19
+ If **first time**, give a brief walkthrough before the interview:
20
+
21
+ > "Let me explain how this works, then we'll set it up for your project.
22
+ >
23
+ > Claude on Rails gives your Claude Code sessions a **session loop** —
24
+ > a start and end routine that creates continuity between sessions.
25
+ >
26
+ > - **`/orient`** runs at the start. It reads where things stand — what
27
+ > you were working on, what's due, what broke. Instead of starting
28
+ > blind, Claude starts informed.
29
+ > - **`/debrief`** runs at the end. It records what happened — what got
30
+ > done, what's still open, what you learned. That's what orient reads
31
+ > next time.
32
+ >
33
+ > Beyond the session loop, there are optional modules: **work tracking**
34
+ > (a local task database), **planning** (structured plans with critique
35
+ > before you build), **audit** (expert perspectives that review your
36
+ > codebase), and more. We'll get to those after we talk about your project.
37
+ >
38
+ > The whole system is customizable through small files called phase files.
39
+ > You don't need to touch them now — that's what this onboarding does."
40
+
41
+ Then proceed to the interview. Keep it conversational — if they ask
42
+ questions about the system, answer them before moving on.
43
+
44
+ If **experienced** (they've used it before, or say "I know how it works"),
45
+ skip the walkthrough entirely and go straight to the interview.
46
+
12
47
  ## Communication Calibration
13
48
 
14
49
  Don't ask the user how technical they are. Listen to how they talk.
@@ -0,0 +1,103 @@
1
+ # Post-Onboard Audit — Configuration Sanity Check
2
+
3
+ After generating all files and presenting the summary, run a lightweight
4
+ audit from the box-health perspective to catch configuration issues before
5
+ the user starts their first session.
6
+
7
+ When this file is absent or empty, the default behavior is: run the audit
8
+ as described below. To explicitly skip it, write only `skip: true`.
9
+
10
+ ## Why This Exists
11
+
12
+ Onboard generates a lot of files from conversation. The interview is
13
+ freeform — the user might mention a database but the data-sync phase
14
+ doesn't get wired. They might skip a module but a phase file references
15
+ it. They might describe a deployment pipeline but no health check covers
16
+ it. These gaps are invisible until orient runs and something is wrong.
17
+
18
+ A quick audit immediately after generation catches these before the user
19
+ starts relying on the configuration.
20
+
21
+ ## What to Check
22
+
23
+ Run as the **box-health perspective** but scoped to what onboard just
24
+ generated. This is NOT a full audit — it's a focused sanity check on
25
+ the fresh configuration.
26
+
27
+ ### 1. Interview–Configuration Coherence
28
+
29
+ Compare what the interview revealed against what was generated:
30
+
31
+ - **Technologies mentioned** → Are they reflected in `_context.md` scan
32
+ scopes and relevant phase files?
33
+ - **Pain points described** → Did at least one phase file or health check
34
+ address each significant pain point?
35
+ - **Data sources mentioned** → Is `data-sync.md` wired if the project has
36
+ remote data? Is it absent if the project is purely local?
37
+ - **Collaboration details** → If multiple people work on the project, are
38
+ coordination-relevant checks present?
39
+
40
+ ### 2. Module–Phase Alignment
41
+
42
+ Cross-reference `.pibrc.json` (installed vs skipped modules) against the
43
+ generated phase files:
44
+
45
+ - **Skipped modules:** No phase file should reference a skipped module's
46
+ infrastructure. If work-tracking was skipped, no phase should reference
47
+ `pib.db` or `pib-db.js`. If audit was skipped, no phase should reference
48
+ `_groups.yaml` or perspective activation.
49
+ - **Installed modules:** Each installed module should have at least a
50
+ minimal presence in the generated configuration. A module that's installed
51
+ but has zero phase file references is a configuration gap.
52
+
53
+ ### 3. Structural Basics
54
+
55
+ Quick filesystem checks:
56
+
57
+ - Every generated file is valid markdown (no truncated content, no
58
+ template placeholders left unfilled)
59
+ - Phase files that reference other files point at files that exist
60
+ - `_context.md` has non-empty project description, stack, and scan scopes
61
+ - `system-status.md` exists and has initial content
62
+ - Hook scripts in `.claude/hooks/` are executable (if hooks module adopted)
63
+
64
+ ### 4. First-Session Readiness
65
+
66
+ Simulate what `/orient` will do on its first run:
67
+
68
+ - Walk through orient's phases mentally. For each phase that will run,
69
+ verify the files it reads exist and have content.
70
+ - If orient would hit an empty phase that should have content (given what
71
+ the interview revealed), flag it.
72
+ - If debrief would try to update a file that doesn't exist yet, flag it.
73
+
74
+ ## How to Present
75
+
76
+ **If everything checks out:** One line after the summary:
77
+
78
+ > "Configuration looks clean — orient should work on first run."
79
+
80
+ **If issues are found:** Present them briefly, grouped by severity:
81
+
82
+ > "Before you run /orient, I noticed a few things:
83
+ >
84
+ > - data-sync.md references your PostgreSQL database, but no connection
85
+ > details are in the phase file. Orient will try to sync and fail.
86
+ > - The security perspective is activated but _context.md doesn't include
87
+ > API routes in its scan scopes — it won't find anything to review.
88
+ >
89
+ > Want me to fix these now?"
90
+
91
+ Fix issues immediately if the user says yes. This is not a deferred
92
+ finding — it's a pre-flight check.
93
+
94
+ ## What This Is NOT
95
+
96
+ - **Not a full box-health audit.** That runs periodically via /audit and
97
+ covers telemetry, usage patterns, drift over time. This only checks
98
+ what was just generated.
99
+ - **Not a product quality review.** Whether the _context.md is well-written
100
+ or the health checks are comprehensive — that improves through use.
101
+ This just checks that the configuration is structurally sound.
102
+ - **Not blocking.** If the audit finds issues and the user wants to move
103
+ on, let them. The issues will surface again naturally when orient runs.
@@ -84,7 +84,9 @@ sessions, and project-specific context.
84
84
  **Default (absent/empty):** Read at minimum:
85
85
  - The project's root `CLAUDE.md` (already loaded by Claude Code)
86
86
  - `system-status.md` or equivalent state file if one exists
87
- - Memory files from prior sessions if the project uses memory
87
+ - `.claude/memory/patterns/` enforcement patterns from prior sessions.
88
+ Scan the directory, read each pattern file. These are project-level
89
+ feedback that guides behavior (what to avoid, what to keep doing).
88
90
 
89
91
  The goal: build a mental model of where things stand before doing
90
92
  anything else.
@@ -5,21 +5,12 @@ of where things stand. The /orient skill reads this file and loads each
5
5
  item before proceeding.
6
6
 
7
7
  When this file is absent or empty, the default behavior is: read the
8
- project's root CLAUDE.md, system-status.md, and relevant memory files.
9
- To explicitly skip context loading, write only `skip: true`.
8
+ project's root CLAUDE.md, system-status.md, and enforcement patterns
9
+ from `.claude/memory/patterns/`. To explicitly skip context loading,
10
+ write only `skip: true`.
10
11
 
11
- ## What to Include
12
+ ## Default Context Sources
12
13
 
13
- For each context source, provide:
14
- - **What** — the file or data to read
15
- - **Why** — what it tells you about current state
16
- - **How** — the command or tool to read it (Read tool, sqlite3, curl, etc.)
17
-
18
- ## Example Context Sources
19
-
20
- Uncomment and adapt these for your project:
21
-
22
- <!--
23
14
  ### System Status
24
15
  ```
25
16
  Read system-status.md
@@ -28,14 +19,30 @@ The single-source-of-truth for what's built, what's broken, and what's
28
19
  next. Read every session — it's the fastest way to know where things
29
20
  stand.
30
21
 
31
- ### Memory Files
22
+ ### Enforcement Patterns
23
+ ```
24
+ Scan .claude/memory/patterns/ — read each pattern file.
25
+ ```
26
+ Project-level feedback from prior sessions. These are consolidated
27
+ observations about what works and what doesn't — they guide behavior
28
+ so the same mistakes aren't repeated. Patterns with `enforcement: guide`
29
+ are behavioral rules. Patterns with `enforcement: prevent` or `detect`
30
+ should already be encoded as hooks or rules, but reading them provides
31
+ context for why those guardrails exist.
32
+
33
+ ## Additional Context Sources
34
+
35
+ Uncomment and adapt these for your project:
36
+
37
+ <!--
38
+ ### Memory Index
32
39
  ```
33
- Read memory/MEMORY.md for the index, then load files relevant to the
34
- session's likely focus.
40
+ Read .claude/memory/MEMORY.md for the index, then load files relevant
41
+ to the session's likely focus.
35
42
  ```
36
- Persistent context from prior sessions user preferences, project
37
- state, feedback patterns, references. Don't read everything scan
38
- the index and load what's relevant.
43
+ If your project uses a memory index beyond patterns (user context,
44
+ project state, references), scan the index and load what's relevant.
45
+ Don't read everything selective loading based on session focus.
39
46
 
40
47
  ### Project-Specific State
41
48
  ```