dotdog 0.8.1 → 0.8.3

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.
Files changed (2) hide show
  1. package/dist/cli.js +31 -0
  2. package/package.json +1 -1
package/dist/cli.js CHANGED
@@ -1,4 +1,6 @@
1
1
  #!/usr/bin/env node
2
+ import { createRequire } from "node:module";
3
+ var __require = /* @__PURE__ */ createRequire(import.meta.url);
2
4
 
3
5
  // ../../node_modules/.bun/commander@15.0.0/node_modules/commander/lib/error.js
4
6
  class CommanderError extends Error {
@@ -4804,6 +4806,35 @@ program2.command("badge [dir]").description("Generate dotdog-badge.svg (shields.
4804
4806
  if (!found)
4805
4807
  console.log(source_default.yellow("No projects found. Run dotdog init first."));
4806
4808
  });
4809
+ program2.command("convert <file>").description("Convert an .md file to .dog — rename + validate").action((f) => {
4810
+ const { existsSync: existsSync4, renameSync, readFileSync: readFileSync4, writeFileSync: writeFileSync3 } = __require("fs");
4811
+ const { join: join4, dirname, basename } = __require("path");
4812
+ const path2 = resolvePath2(f);
4813
+ if (!existsSync4(path2)) {
4814
+ console.log(source_default.red(`File not found: ${f}`));
4815
+ return;
4816
+ }
4817
+ if (!path2.endsWith(".md")) {
4818
+ console.log(source_default.yellow(`Only .md files can be converted.`));
4819
+ return;
4820
+ }
4821
+ const dogPath = path2.replace(/\.md$/, ".dog");
4822
+ if (existsSync4(dogPath)) {
4823
+ console.log(source_default.yellow(`${dogPath} already exists.`));
4824
+ return;
4825
+ }
4826
+ const content = readFileSync4(path2, "utf-8");
4827
+ renameSync(path2, dogPath);
4828
+ if (!content.match(/^##\s/m)) {
4829
+ const stub = `## Product
4830
+
4831
+ (Describe your product here)
4832
+ `;
4833
+ writeFileSync3(dogPath, stub + content);
4834
+ }
4835
+ console.log(source_default.green(` ✓ ${basename(path2)} → ${basename(dogPath)}`));
4836
+ console.log(source_default.gray(" Run: dotdog validate"));
4837
+ });
4807
4838
  program2.parse();
4808
4839
  export {
4809
4840
  parseToJSON,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dotdog",
3
- "version": "0.8.1",
3
+ "version": "0.8.3",
4
4
  "description": "CLI tool for structured software specifications. Validate .dog files, compile .dag graphs, query via MCP.",
5
5
  "type": "module",
6
6
  "main": "dist/cli.js",