ai-spec-tool 0.1.4 → 0.1.5
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/bin/ai-spec-tool.js +15 -1
- package/package.json +1 -1
package/bin/ai-spec-tool.js
CHANGED
|
@@ -8,6 +8,7 @@ const ASSET_ROOT = path.resolve(__dirname, "..", "assets");
|
|
|
8
8
|
const TEMPLATE_AGENTS = path.join(ASSET_ROOT, "AGENTS.md");
|
|
9
9
|
const TEMPLATE_AGENTS_DIR = path.join(ASSET_ROOT, ".agents");
|
|
10
10
|
const TEMPLATE_DOCS_DIR = path.join(ASSET_ROOT, "docs");
|
|
11
|
+
const PKG_JSON = path.resolve(__dirname, "..", "package.json");
|
|
11
12
|
|
|
12
13
|
const START = "<!-- AI-SPEC-TOOL:START -->";
|
|
13
14
|
const END = "<!-- AI-SPEC-TOOL:END -->";
|
|
@@ -176,14 +177,27 @@ async function init(options) {
|
|
|
176
177
|
}
|
|
177
178
|
}
|
|
178
179
|
|
|
180
|
+
function getVersion() {
|
|
181
|
+
try {
|
|
182
|
+
const pkg = JSON.parse(fs.readFileSync(PKG_JSON, "utf8"));
|
|
183
|
+
return pkg.version || "unknown";
|
|
184
|
+
} catch (err) {
|
|
185
|
+
return "unknown";
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
|
|
179
189
|
function main() {
|
|
180
190
|
const [command, ...args] = process.argv.slice(2);
|
|
181
191
|
const options = {
|
|
182
192
|
force: args.includes("--force"),
|
|
183
193
|
ask: args.includes("--ask")
|
|
184
194
|
};
|
|
195
|
+
if (command === "--version" || command === "-v") {
|
|
196
|
+
console.log(getVersion());
|
|
197
|
+
return;
|
|
198
|
+
}
|
|
185
199
|
if (!command || command === "help" || command === "--help" || command === "-h") {
|
|
186
|
-
console.log("ai-spec-tool\n\nUsage:\n ai-spec-tool init [--force|--ask]\n");
|
|
200
|
+
console.log("ai-spec-tool\n\nUsage:\n ai-spec-tool init [--force|--ask]\n ai-spec-tool --version\n");
|
|
187
201
|
return;
|
|
188
202
|
}
|
|
189
203
|
if (command === "init") {
|