ai-spec-tool 0.1.4 → 0.1.7

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.
@@ -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 -->";
@@ -146,17 +147,16 @@ async function init(options) {
146
147
  conflictsResolved: []
147
148
  };
148
149
 
149
- if (!fs.existsSync(TEMPLATE_AGENTS) || !fs.existsSync(TEMPLATE_AGENTS_DIR)) {
150
- console.error("Assets missing. Please reinstall ai-spec-tool.");
151
- process.exit(1);
150
+ if (fs.existsSync(TEMPLATE_AGENTS_DIR)) {
151
+ copyDirSafe(TEMPLATE_AGENTS_DIR, targetAgentsDir, report, options);
152
152
  }
153
-
154
- copyDirSafe(TEMPLATE_AGENTS_DIR, targetAgentsDir, report, options);
155
153
  if (fs.existsSync(TEMPLATE_DOCS_DIR)) {
156
154
  const targetDocsDir = path.join(cwd, "docs");
157
155
  copyDirSafe(TEMPLATE_DOCS_DIR, targetDocsDir, report, options);
158
156
  }
159
- updateAgentsMd(targetAgents, report);
157
+ if (fs.existsSync(TEMPLATE_AGENTS)) {
158
+ updateAgentsMd(targetAgents, report);
159
+ }
160
160
  await resolveConflictsInteractively(report, options);
161
161
 
162
162
  console.log("ai-spec-tool init complete.");
@@ -176,14 +176,27 @@ async function init(options) {
176
176
  }
177
177
  }
178
178
 
179
+ function getVersion() {
180
+ try {
181
+ const pkg = JSON.parse(fs.readFileSync(PKG_JSON, "utf8"));
182
+ return pkg.version || "unknown";
183
+ } catch (err) {
184
+ return "unknown";
185
+ }
186
+ }
187
+
179
188
  function main() {
180
189
  const [command, ...args] = process.argv.slice(2);
181
190
  const options = {
182
191
  force: args.includes("--force"),
183
192
  ask: args.includes("--ask")
184
193
  };
194
+ if (command === "--version" || command === "-v") {
195
+ console.log(getVersion());
196
+ return;
197
+ }
185
198
  if (!command || command === "help" || command === "--help" || command === "-h") {
186
- console.log("ai-spec-tool\n\nUsage:\n ai-spec-tool init [--force|--ask]\n");
199
+ console.log("ai-spec-tool\n\nUsage:\n ai-spec-tool init [--force|--ask]\n ai-spec-tool --version\n");
187
200
  return;
188
201
  }
189
202
  if (command === "init") {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ai-spec-tool",
3
- "version": "0.1.4",
3
+ "version": "0.1.7",
4
4
  "description": "Installable agents + rules for AI spec workflows",
5
5
  "bin": {
6
6
  "ai-spec-tool": "bin/ai-spec-tool.js"