sc-research 1.0.8 → 1.0.10
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 +6 -7
- package/dist/cli.js +15 -72
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -38,9 +38,8 @@ sc-research init --ai claude,cursor
|
|
|
38
38
|
sc-research init --ai all
|
|
39
39
|
```
|
|
40
40
|
|
|
41
|
-
This now
|
|
42
|
-
|
|
43
|
-
- Reads/updates your project `package.json` scripts so commands work immediately
|
|
41
|
+
This now installs SC-Research templates for selected platform(s) only.
|
|
42
|
+
It does not read, write, or update `package.json`.
|
|
44
43
|
|
|
45
44
|
Template architecture:
|
|
46
45
|
- `templates/base/` is the canonical source for command/skill content
|
|
@@ -54,10 +53,10 @@ Template architecture:
|
|
|
54
53
|
sc-research init --ai claude
|
|
55
54
|
```
|
|
56
55
|
|
|
57
|
-
|
|
58
|
-
- `
|
|
59
|
-
- `
|
|
60
|
-
- `
|
|
56
|
+
Then run commands directly from your terminal:
|
|
57
|
+
- `sc-research research "<topic>"`
|
|
58
|
+
- `sc-research research:deep "<topic>"`
|
|
59
|
+
- `sc-research visualize`
|
|
61
60
|
|
|
62
61
|
2. **Open the project in Claude Code**
|
|
63
62
|
|
package/dist/cli.js
CHANGED
|
@@ -129,6 +129,14 @@ function renderClaudeWithRoot(template, rootDir) {
|
|
|
129
129
|
function normalizeBody2(body) {
|
|
130
130
|
return body.endsWith(`
|
|
131
131
|
`) ? body : `${body}
|
|
132
|
+
`;
|
|
133
|
+
}
|
|
134
|
+
function renderFrontmatter2(lines) {
|
|
135
|
+
return `---
|
|
136
|
+
${lines.join(`
|
|
137
|
+
`)}
|
|
138
|
+
---
|
|
139
|
+
|
|
132
140
|
`;
|
|
133
141
|
}
|
|
134
142
|
function renderMarkdownOnly(template, options) {
|
|
@@ -138,12 +146,17 @@ function renderMarkdownOnly(template, options) {
|
|
|
138
146
|
if (template.kind === "skill") {
|
|
139
147
|
return {
|
|
140
148
|
path: `${normalizedRoot}/${normalizedSkillDir}/${template.id}/${options.skillFileName}`,
|
|
141
|
-
content:
|
|
149
|
+
content: `${renderFrontmatter2([
|
|
150
|
+
`name: ${template.id}`,
|
|
151
|
+
`description: ${template.description}`
|
|
152
|
+
])}${normalizeBody2(template.body)}`
|
|
142
153
|
};
|
|
143
154
|
}
|
|
144
155
|
return {
|
|
145
156
|
path: `${normalizedRoot}/${normalizedCommandDir}/${template.id}.md`,
|
|
146
|
-
content:
|
|
157
|
+
content: `${renderFrontmatter2([
|
|
158
|
+
`description: ${template.description}`
|
|
159
|
+
])}${normalizeBody2(template.body)}`
|
|
147
160
|
};
|
|
148
161
|
}
|
|
149
162
|
// src/cli/platforms/config/load-platform-config.ts
|
|
@@ -358,10 +371,6 @@ async function runInit(opts) {
|
|
|
358
371
|
logger.info(` Mode: dry-run (no files will be written)`);
|
|
359
372
|
}
|
|
360
373
|
ensureDir(projectRoot);
|
|
361
|
-
const packageSummary = syncPackageJson(projectRoot, {
|
|
362
|
-
dryRun: opts.dryRun,
|
|
363
|
-
force: opts.force
|
|
364
|
-
});
|
|
365
374
|
const summariesByTarget = new Map;
|
|
366
375
|
for (const target of targets) {
|
|
367
376
|
const adapter = getAdapter(target);
|
|
@@ -394,12 +403,6 @@ async function runInit(opts) {
|
|
|
394
403
|
logger.info(` Total skipped: ${totalSummary.skipped}`);
|
|
395
404
|
logger.info(` Total overwritten: ${totalSummary.overwritten}`);
|
|
396
405
|
logger.info("");
|
|
397
|
-
logger.info("package.json:");
|
|
398
|
-
logger.info(` Created: ${packageSummary.created ? 1 : 0}`);
|
|
399
|
-
logger.info(` Scripts added: ${packageSummary.scriptsAdded}`);
|
|
400
|
-
logger.info(` Scripts skipped: ${packageSummary.scriptsSkipped}`);
|
|
401
|
-
logger.info(` Scripts overwritten: ${packageSummary.scriptsOverwritten}`);
|
|
402
|
-
logger.info("");
|
|
403
406
|
logger.info("Next steps:");
|
|
404
407
|
logger.info(" 1) Ensure your project has required env vars set (for example in .sc-research):");
|
|
405
408
|
logger.info(" - OPENAI_API_KEY");
|
|
@@ -429,66 +432,6 @@ function findPackageRoot2() {
|
|
|
429
432
|
}
|
|
430
433
|
return null;
|
|
431
434
|
}
|
|
432
|
-
function syncPackageJson(projectRoot, options) {
|
|
433
|
-
const packageJsonPath = path4.join(projectRoot, "package.json");
|
|
434
|
-
const summary = {
|
|
435
|
-
created: false,
|
|
436
|
-
scriptsAdded: 0,
|
|
437
|
-
scriptsSkipped: 0,
|
|
438
|
-
scriptsOverwritten: 0
|
|
439
|
-
};
|
|
440
|
-
const desiredScripts = {
|
|
441
|
-
research: "sc-research research",
|
|
442
|
-
"research:deep": "sc-research research --depth=deep",
|
|
443
|
-
visualize: "sc-research visualize"
|
|
444
|
-
};
|
|
445
|
-
let pkg;
|
|
446
|
-
if (fs4.existsSync(packageJsonPath)) {
|
|
447
|
-
const raw = fs4.readFileSync(packageJsonPath, "utf-8");
|
|
448
|
-
try {
|
|
449
|
-
pkg = JSON.parse(raw);
|
|
450
|
-
} catch {
|
|
451
|
-
throw new Error(`Invalid JSON in ${packageJsonPath}. Fix it before running init.`);
|
|
452
|
-
}
|
|
453
|
-
} else {
|
|
454
|
-
summary.created = true;
|
|
455
|
-
pkg = {
|
|
456
|
-
name: sanitizePackageName(path4.basename(projectRoot)),
|
|
457
|
-
private: true,
|
|
458
|
-
version: "0.0.0",
|
|
459
|
-
scripts: {}
|
|
460
|
-
};
|
|
461
|
-
}
|
|
462
|
-
const scriptsValue = pkg.scripts;
|
|
463
|
-
const scripts = scriptsValue && typeof scriptsValue === "object" && !Array.isArray(scriptsValue) ? { ...scriptsValue } : {};
|
|
464
|
-
for (const [name, command] of Object.entries(desiredScripts)) {
|
|
465
|
-
const current = scripts[name];
|
|
466
|
-
if (!current) {
|
|
467
|
-
scripts[name] = command;
|
|
468
|
-
summary.scriptsAdded++;
|
|
469
|
-
continue;
|
|
470
|
-
}
|
|
471
|
-
if (current !== command) {
|
|
472
|
-
if (options.force) {
|
|
473
|
-
scripts[name] = command;
|
|
474
|
-
summary.scriptsOverwritten++;
|
|
475
|
-
} else {
|
|
476
|
-
summary.scriptsSkipped++;
|
|
477
|
-
}
|
|
478
|
-
}
|
|
479
|
-
}
|
|
480
|
-
pkg.scripts = scripts;
|
|
481
|
-
const shouldWrite = summary.created || summary.scriptsAdded > 0 || summary.scriptsOverwritten > 0;
|
|
482
|
-
if (shouldWrite && !options.dryRun) {
|
|
483
|
-
fs4.writeFileSync(packageJsonPath, `${JSON.stringify(pkg, null, 2)}
|
|
484
|
-
`);
|
|
485
|
-
}
|
|
486
|
-
return summary;
|
|
487
|
-
}
|
|
488
|
-
function sanitizePackageName(name) {
|
|
489
|
-
const cleaned = name.toLowerCase().trim().replace(/[^a-z0-9-_.]/g, "-").replace(/^-+/, "").replace(/-+$/, "");
|
|
490
|
-
return cleaned || "sc-research-project";
|
|
491
|
-
}
|
|
492
435
|
|
|
493
436
|
// src/entries/cli.ts
|
|
494
437
|
var DEFAULT_ENV_FILE = ".sc-research";
|