sillyspec 3.5.0 → 3.5.1
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/package.json +1 -1
- package/src/index.js +6 -1
- package/src/init.js +11 -6
package/package.json
CHANGED
package/src/index.js
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
|
|
10
10
|
import { existsSync, readdirSync, readFileSync, statSync } from 'fs';
|
|
11
11
|
import { join, resolve } from 'path';
|
|
12
|
-
import { cmdInit } from './init.js';
|
|
12
|
+
import { cmdInit, getVersion } from './init.js';
|
|
13
13
|
|
|
14
14
|
const SILLYSPEC_DIR = '.sillyspec';
|
|
15
15
|
const CODEBASE_DIR = `${SILLYSPEC_DIR}/codebase`;
|
|
@@ -501,6 +501,11 @@ SillySpec CLI — 流程状态机
|
|
|
501
501
|
async function main() {
|
|
502
502
|
const args = process.argv.slice(2);
|
|
503
503
|
|
|
504
|
+
if (args[0] === '--version' || args[0] === '-v') {
|
|
505
|
+
console.log(getVersion());
|
|
506
|
+
process.exit(0);
|
|
507
|
+
}
|
|
508
|
+
|
|
504
509
|
if (args.length === 0 || args[0] === 'help' || args[0] === '--help' || args[0] === '-h') {
|
|
505
510
|
printUsage();
|
|
506
511
|
process.exit(0);
|
package/src/init.js
CHANGED
|
@@ -91,33 +91,35 @@ const INJECTION_CONTENT = `## SillySpec — 规范驱动开发
|
|
|
91
91
|
|
|
92
92
|
// ── 适配器 ──
|
|
93
93
|
|
|
94
|
-
function generateClaude(projectDir, name, desc, body, argHint) {
|
|
94
|
+
function generateClaude(projectDir, name, desc, body, argHint, version) {
|
|
95
95
|
const outDir = join(projectDir, '.claude', 'commands', 'sillyspec');
|
|
96
96
|
mkdirSync(outDir, { recursive: true });
|
|
97
97
|
writeFileSync(join(outDir, `${name}.md`),
|
|
98
98
|
`---
|
|
99
99
|
description: ${desc}
|
|
100
100
|
argument-hint: "${argHint}"
|
|
101
|
+
version: "${version}"
|
|
101
102
|
---
|
|
102
103
|
|
|
103
104
|
${body}`
|
|
104
105
|
);
|
|
105
106
|
}
|
|
106
107
|
|
|
107
|
-
function generateClaudeSkills(projectDir, name, desc, body, argHint) {
|
|
108
|
+
function generateClaudeSkills(projectDir, name, desc, body, argHint, version) {
|
|
108
109
|
const outDir = join(projectDir, '.claude', 'skills', `sillyspec-${name}`);
|
|
109
110
|
mkdirSync(outDir, { recursive: true });
|
|
110
111
|
writeFileSync(join(outDir, 'SKILL.md'),
|
|
111
112
|
`---
|
|
112
113
|
name: sillyspec:${name}
|
|
113
114
|
description: ${desc}
|
|
115
|
+
version: "${version}"
|
|
114
116
|
---
|
|
115
117
|
|
|
116
118
|
${body}`
|
|
117
119
|
);
|
|
118
120
|
}
|
|
119
121
|
|
|
120
|
-
function generateCursor(projectDir, name, desc, body, argHint) {
|
|
122
|
+
function generateCursor(projectDir, name, desc, body, argHint, version) {
|
|
121
123
|
const outDir = join(projectDir, '.cursor', 'commands');
|
|
122
124
|
mkdirSync(outDir, { recursive: true });
|
|
123
125
|
writeFileSync(join(outDir, `sillyspec-${name}.md`),
|
|
@@ -125,19 +127,21 @@ function generateCursor(projectDir, name, desc, body, argHint) {
|
|
|
125
127
|
name: /sillyspec-${name}
|
|
126
128
|
id: sillyspec-${name}
|
|
127
129
|
description: ${desc}
|
|
130
|
+
version: "${version}"
|
|
128
131
|
---
|
|
129
132
|
|
|
130
133
|
${body}`
|
|
131
134
|
);
|
|
132
135
|
}
|
|
133
136
|
|
|
134
|
-
function generateOpenclaw(projectDir, name, desc, body, argHint) {
|
|
137
|
+
function generateOpenclaw(projectDir, name, desc, body, argHint, version) {
|
|
135
138
|
const outDir = join(projectDir, '.openclaw', 'skills', `sillyspec-${name}`);
|
|
136
139
|
mkdirSync(outDir, { recursive: true });
|
|
137
140
|
writeFileSync(join(outDir, 'SKILL.md'),
|
|
138
141
|
`---
|
|
139
142
|
name: sillyspec:${name}
|
|
140
143
|
description: ${desc}
|
|
144
|
+
version: "${version}"
|
|
141
145
|
---
|
|
142
146
|
|
|
143
147
|
${body}`
|
|
@@ -259,12 +263,13 @@ async function doInstall(projectDir, tools, isWorkspace, subprojects = []) {
|
|
|
259
263
|
const spinner = ora(`安装 ${label}... (${i + 1}/${tools.length})`).start();
|
|
260
264
|
try {
|
|
261
265
|
const gen = GENERATORS[toolName];
|
|
266
|
+
const ver = getVersion();
|
|
262
267
|
for (const file of templateFiles) {
|
|
263
268
|
const name = file.replace('.md', '');
|
|
264
269
|
const desc = DESCRIPTIONS[name] || `SillySpec ${name}`;
|
|
265
270
|
const argHint = ARG_HINTS[name] || '';
|
|
266
271
|
const body = readFileSync(join(TEMPLATE_DIR, file), 'utf8');
|
|
267
|
-
gen(projectDir, name, desc, body, argHint);
|
|
272
|
+
gen(projectDir, name, desc, body, argHint, ver);
|
|
268
273
|
count++;
|
|
269
274
|
}
|
|
270
275
|
spinner.succeed(`${label} 完成`);
|
|
@@ -329,7 +334,7 @@ function showSummary(version, tools, isWorkspace, count) {
|
|
|
329
334
|
|
|
330
335
|
// ── 读取版本号 ──
|
|
331
336
|
|
|
332
|
-
function getVersion() {
|
|
337
|
+
export function getVersion() {
|
|
333
338
|
try {
|
|
334
339
|
const pkg = JSON.parse(readFileSync(resolve(__dirname, '..', 'package.json'), 'utf8'));
|
|
335
340
|
return pkg.version;
|