create-claude-rails 0.3.0 → 0.3.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 +12 -4
- package/lib/copy.js +7 -5
- package/package.json +1 -1
package/lib/cli.js
CHANGED
|
@@ -384,14 +384,22 @@ async function run() {
|
|
|
384
384
|
|
|
385
385
|
const stat = fs.statSync(srcPath);
|
|
386
386
|
if (stat.isDirectory()) {
|
|
387
|
-
// For skill directories, skip phases/ — absent phase files
|
|
388
|
-
// skeleton defaults. Phase files are created by /onboard
|
|
389
|
-
// on the project interview, not copied as generic templates.
|
|
390
|
-
|
|
387
|
+
// For most skill directories, skip phases/ — absent phase files
|
|
388
|
+
// use skeleton defaults. Phase files are created by /onboard
|
|
389
|
+
// based on the project interview, not copied as generic templates.
|
|
390
|
+
// Exception: perspectives (always copied), and skills whose phase
|
|
391
|
+
// files ARE the instructions (onboard, seed, cor-upgrade, publish,
|
|
392
|
+
// extract) — these need their phases to function.
|
|
393
|
+
const alwaysCopyPhases = [
|
|
394
|
+
'skills/perspectives', 'skills/onboard', 'skills/seed',
|
|
395
|
+
'skills/cor-upgrade', 'skills/publish', 'skills/extract',
|
|
396
|
+
];
|
|
397
|
+
const isSkill = tmpl.startsWith('skills/') && !alwaysCopyPhases.some(p => tmpl.startsWith(p));
|
|
391
398
|
const results = await copyTemplates(srcPath, destPath, {
|
|
392
399
|
dryRun: flags.dryRun,
|
|
393
400
|
skipConflicts: flags.yes,
|
|
394
401
|
skipPhases: isSkill,
|
|
402
|
+
projectRoot: projectDir,
|
|
395
403
|
});
|
|
396
404
|
totalCopied += results.copied.length;
|
|
397
405
|
totalSkipped += results.skipped.length;
|
package/lib/copy.js
CHANGED
|
@@ -11,19 +11,21 @@ function hashContent(content) {
|
|
|
11
11
|
* Recursively copy files from src to dest, surfacing conflicts.
|
|
12
12
|
* Returns { copied: string[], skipped: string[], overwritten: string[] }
|
|
13
13
|
*/
|
|
14
|
-
async function copyTemplates(src, dest, { dryRun = false, skipConflicts = false, skipPhases = false } = {}) {
|
|
14
|
+
async function copyTemplates(src, dest, { dryRun = false, skipConflicts = false, skipPhases = false, projectRoot = null } = {}) {
|
|
15
15
|
const results = { copied: [], skipped: [], overwritten: [], manifest: {} };
|
|
16
|
-
await walkAndCopy(src, dest, src, results, dryRun, skipConflicts, skipPhases);
|
|
16
|
+
await walkAndCopy(src, dest, src, results, dryRun, skipConflicts, skipPhases, projectRoot);
|
|
17
17
|
return results;
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
-
async function walkAndCopy(srcRoot, destRoot, currentSrc, results, dryRun, skipConflicts, skipPhases) {
|
|
20
|
+
async function walkAndCopy(srcRoot, destRoot, currentSrc, results, dryRun, skipConflicts, skipPhases, projectRoot) {
|
|
21
21
|
const entries = fs.readdirSync(currentSrc, { withFileTypes: true });
|
|
22
22
|
|
|
23
23
|
for (const entry of entries) {
|
|
24
24
|
const srcPath = path.join(currentSrc, entry.name);
|
|
25
25
|
const relPath = path.relative(srcRoot, srcPath);
|
|
26
26
|
const destPath = path.join(destRoot, relPath);
|
|
27
|
+
// Display path relative to project root for clearer conflict prompts
|
|
28
|
+
const displayPath = projectRoot ? path.relative(projectRoot, destPath) : relPath;
|
|
27
29
|
|
|
28
30
|
if (entry.isDirectory()) {
|
|
29
31
|
// Skip phases/ directories — absent phase files use skeleton defaults,
|
|
@@ -35,7 +37,7 @@ async function walkAndCopy(srcRoot, destRoot, currentSrc, results, dryRun, skipC
|
|
|
35
37
|
if (!dryRun && !fs.existsSync(destPath)) {
|
|
36
38
|
fs.mkdirSync(destPath, { recursive: true });
|
|
37
39
|
}
|
|
38
|
-
await walkAndCopy(srcRoot, destRoot, srcPath, results, dryRun, skipConflicts, skipPhases);
|
|
40
|
+
await walkAndCopy(srcRoot, destRoot, srcPath, results, dryRun, skipConflicts, skipPhases, projectRoot);
|
|
39
41
|
} else {
|
|
40
42
|
const incoming = fs.readFileSync(srcPath, 'utf8');
|
|
41
43
|
const incomingHash = hashContent(incoming);
|
|
@@ -58,7 +60,7 @@ async function walkAndCopy(srcRoot, destRoot, currentSrc, results, dryRun, skipC
|
|
|
58
60
|
const response = await prompts({
|
|
59
61
|
type: 'select',
|
|
60
62
|
name: 'action',
|
|
61
|
-
message: `File exists: ${
|
|
63
|
+
message: `File exists: ${displayPath}`,
|
|
62
64
|
choices: [
|
|
63
65
|
{ title: 'Keep existing', value: 'keep' },
|
|
64
66
|
{ title: 'Overwrite with template', value: 'overwrite' },
|