dotdog 0.1.5 → 0.1.6

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 +53 -0
  2. package/package.json +1 -1
package/dist/cli.js CHANGED
@@ -3067,6 +3067,59 @@ program2.command("compile [dir]").option("-o, --output <file>").action((d = ".",
3067
3067
  if (!found)
3068
3068
  console.log(source_default.yellow("No projects found."));
3069
3069
  });
3070
+ program2.command("staleness [dir]").action((d = ".") => {
3071
+ const dir = resolvePath(d);
3072
+ const dirs = [join(dir, "projects"), join(dir, "specs"), dir];
3073
+ console.log(source_default.bold(`Staleness Audit
3074
+ `));
3075
+ for (const dd of dirs) {
3076
+ if (!existsSync(dd))
3077
+ continue;
3078
+ const projects = readdirSync(dd, { withFileTypes: true }).filter((e) => e.isDirectory()).map((e) => e.name);
3079
+ for (const p of projects) {
3080
+ const pd = join(dd, p, "specs");
3081
+ if (!existsSync(pd))
3082
+ continue;
3083
+ const planFile = join(pd, "plan.dog");
3084
+ if (!existsSync(planFile)) {
3085
+ console.log(source_default.yellow(` ${p}: No plan.dog`));
3086
+ continue;
3087
+ }
3088
+ const plan = readFileSync(planFile, "utf-8");
3089
+ const tasks = [...plan.matchAll(/^\s*- \[([ x])\]\s+(.+)/gm)];
3090
+ let issues = 0;
3091
+ for (const m of tasks) {
3092
+ const done = m[1] === "x";
3093
+ const text = m[2].toLowerCase();
3094
+ if (text.includes("npm publish") || text.includes("npm install")) {
3095
+ try {
3096
+ const pkg2 = JSON.parse(readFileSync(join(resolvePath("."), "packages/dotdog/package.json"), "utf-8"));
3097
+ if (pkg2.version && !done) {
3098
+ console.log(source_default.yellow(` ⚠ Should be [x]: ${m[2].trim()}`));
3099
+ issues++;
3100
+ }
3101
+ } catch {}
3102
+ }
3103
+ if (text.includes("compile")) {
3104
+ if (!done) {
3105
+ console.log(source_default.yellow(` ⚠ Should be [x]: ${m[2].trim()}`));
3106
+ issues++;
3107
+ }
3108
+ }
3109
+ if (text.includes("generate") && !done) {
3110
+ if (existsSync(join(dir, "packages/dotdog/src/cli.ts")) || existsSync(join(dir, "packages/spec-cli/src/generate.ts"))) {
3111
+ console.log(source_default.yellow(` ⚠ Should be [x]: ${m[2].trim()}`));
3112
+ issues++;
3113
+ }
3114
+ }
3115
+ }
3116
+ if (issues === 0)
3117
+ console.log(source_default.green(` ${p}: spec matches reality`));
3118
+ else
3119
+ console.log(source_default.bold(` ${issues} stale items. Update plan.dog.`));
3120
+ }
3121
+ }
3122
+ });
3070
3123
  program2.parse();
3071
3124
  export {
3072
3125
  parseToJSON,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dotdog",
3
- "version": "0.1.5",
3
+ "version": "0.1.6",
4
4
  "description": "The spec dog \u2014 validate, analyze, parse, and generate .dog spec genome files",
5
5
  "type": "module",
6
6
  "main": "dist/cli.js",