@teurons/vds 0.0.4 → 0.0.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.
Files changed (3) hide show
  1. package/README.md +3 -2
  2. package/dist/vds.js +24 -18
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -37,14 +37,15 @@ npx @teurons/vds index [folder] # print the index: every flow and rule, one li
37
37
  npx @teurons/vds update [folder] # install the newest vds, refresh VDS.md
38
38
  ```
39
39
 
40
- `folder` defaults to the current folder.
40
+ `folder` defaults to the current folder, or to `vds-workspace` inside it when the current folder
41
+ is not a workspace itself. So from your project root, `vds check` checks `vds-workspace`.
41
42
 
42
43
  ## A workspace
43
44
 
44
45
  ```text
45
46
  vds-workspace/
46
47
  VDS.md how agents and people work on this spec
47
- .vds.json local settings, such as the studio port
48
+ .vds.json local settings: the port the local studio will use (coming soon)
48
49
  capabilities/<CODE>.yaml rules, each one EARS statement with an id like ONB-01
49
50
  flows/<id>.yaml versioned flows whose steps point at rule ids
50
51
  scenarios/<RULE-ID>.feature Gherkin scenarios, one file per rule
package/dist/vds.js CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
 
3
3
  // src/bin.js
4
- import { readdirSync, readFileSync as readFileSync4 } from "node:fs";
4
+ import { existsSync as existsSync3, readdirSync, readFileSync as readFileSync4 } from "node:fs";
5
5
  import { join as join3, resolve } from "node:path";
6
6
 
7
7
  // ../../specs/js/load.js
@@ -100,7 +100,7 @@ import { join } from "node:path";
100
100
 
101
101
  // src/version.js
102
102
  import { readFileSync as readFileSync2 } from "node:fs";
103
- var baked = false ? null : "0.0.4";
103
+ var baked = false ? null : "0.0.5";
104
104
  var VERSION = process.env.VDS_VERSION ?? baked ?? JSON.parse(readFileSync2(new URL("../package.json", import.meta.url), "utf8")).version;
105
105
  function compare(a, b) {
106
106
  const [x, y] = [a, b].map((v) => v.split("-")[0].split(".").map(Number));
@@ -262,26 +262,32 @@ function readWorkspace(root) {
262
262
  }
263
263
  return files;
264
264
  }
265
+ function defaultFolder() {
266
+ const isWorkspace = [...FOLDERS2, "VDS.md"].some((name) => existsSync3(name));
267
+ return !isWorkspace && existsSync3("vds-workspace") ? "vds-workspace" : ".";
268
+ }
269
+ async function check(folder) {
270
+ const mapper = await loadMapper();
271
+ const findings = mapper.v2Check(readWorkspace(resolve(folder)));
272
+ if ("error" in findings) throw new Error(findings.error);
273
+ if (findings.length === 0) {
274
+ console.log("valid");
275
+ return 0;
276
+ }
277
+ console.error(`${findings.length} problem(s):`);
278
+ for (const f of findings) console.error(`- ${f.path}: ${f.message} [${f.code}]`);
279
+ return 1;
280
+ }
265
281
  async function main(argv) {
266
282
  const guideOnly = argv.includes("--guide-only");
267
- const [command, folder = "."] = argv.filter((a) => a !== "--guide-only");
268
- if (command === "init") return init(resolve(folder));
283
+ const [command, named] = argv.filter((a) => a !== "--guide-only");
284
+ if (command === "init") return init(resolve(named ?? "."));
285
+ const folder = named ?? defaultFolder();
269
286
  if (command === "update") return update(resolve(folder), { guideOnly });
270
- const mapper = await loadMapper();
271
- const files = readWorkspace(resolve(folder));
272
- if (command === "check") {
273
- const findings = mapper.v2Check(files);
274
- if ("error" in findings) throw new Error(findings.error);
275
- if (findings.length === 0) {
276
- console.log("valid");
277
- return 0;
278
- }
279
- console.error(`${findings.length} problem(s):`);
280
- for (const f of findings) console.error(`- ${f.path}: ${f.message} [${f.code}]`);
281
- return 1;
282
- }
287
+ if (command === "check") return check(folder);
283
288
  if (command === "index") {
284
- process.stdout.write(mapper.v2Index(files));
289
+ const mapper = await loadMapper();
290
+ process.stdout.write(mapper.v2Index(readWorkspace(resolve(folder))));
285
291
  return 0;
286
292
  }
287
293
  console.error(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@teurons/vds",
3
- "version": "0.0.4",
3
+ "version": "0.0.5",
4
4
  "description": "The vds command: check, index and run a VDS workspace on your machine.",
5
5
  "type": "module",
6
6
  "bin": {