@archdoc/cli 0.1.0 → 0.3.0

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@archdoc/cli",
3
- "version": "0.1.0",
3
+ "version": "0.3.0",
4
4
  "description": "The archdoc command-line tool.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -28,11 +28,14 @@
28
28
  "dependencies": {
29
29
  "commander": "^14.0.3",
30
30
  "yaml": "^2.9.1",
31
- "@archdoc/analyzers": "0.1.0",
32
- "@archdoc/core": "0.1.0",
33
- "@archdoc/federation": "0.1.0",
34
- "@archdoc/mcp": "0.1.0",
35
- "@archdoc/spec": "0.1.0"
31
+ "@archdoc/analyzers": "0.3.0",
32
+ "@archdoc/core": "0.3.0",
33
+ "@archdoc/federation": "0.3.0",
34
+ "@archdoc/mcp": "0.3.0",
35
+ "@archdoc/spec": "0.3.0"
36
+ },
37
+ "publishConfig": {
38
+ "access": "public"
36
39
  },
37
40
  "scripts": {}
38
41
  }
@@ -1,12 +0,0 @@
1
- import type { Io } from "../io.js";
2
- export interface DataOptions {
3
- model?: string;
4
- json?: boolean;
5
- }
6
- /** `archdoc lineage <entry.field>`: where a field's value comes from and goes, across repos. */
7
- export declare function lineageCommand(field: string, options: DataOptions, io: Io): Promise<number>;
8
- /** `archdoc simulate <journey> --sample <file>`: the path a sample takes, and the records it writes. */
9
- export declare function simulateCommand(journey: string, options: DataOptions & {
10
- sample?: string;
11
- }, io: Io): Promise<number>;
12
- //# sourceMappingURL=data.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"data.d.ts","sourceRoot":"","sources":["../../src/commands/data.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,UAAU,CAAC;AAEnC,MAAM,WAAW,WAAW;IAC1B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB;AAcD,gGAAgG;AAChG,wBAAsB,cAAc,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,WAAW,EAAE,EAAE,EAAE,EAAE,GAAG,OAAO,CAAC,MAAM,CAAC,CAwBjG;AAED,wGAAwG;AACxG,wBAAsB,eAAe,CACnC,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,WAAW,GAAG;IAAE,MAAM,CAAC,EAAE,MAAM,CAAA;CAAE,EAC1C,EAAE,EAAE,EAAE,GACL,OAAO,CAAC,MAAM,CAAC,CA8BjB"}
@@ -1,63 +0,0 @@
1
- import { readFile } from "node:fs/promises";
2
- import { resolve } from "node:path";
3
- import { formatLineage, formatSimulation, hasErrors, lineage, loadModel, simulate, } from "@archdoc/core";
4
- import { parse } from "yaml";
5
- async function load(options, io) {
6
- const model = await loadModel(options.model ?? ".", { cwd: io.cwd });
7
- if (model.diagnostics.some((d) => d.code === "model/not-found")) {
8
- io.err(model.diagnostics[0]?.message ?? "No model found.");
9
- return undefined;
10
- }
11
- if (hasErrors(model.diagnostics)) {
12
- io.err('warning: the model has errors, so answers may be incomplete. Run "archdoc validate".');
13
- }
14
- return model;
15
- }
16
- /** `archdoc lineage <entry.field>`: where a field's value comes from and goes, across repos. */
17
- export async function lineageCommand(field, options, io) {
18
- const model = await load(options, io);
19
- if (!model)
20
- return 1;
21
- const l = lineage(model, field);
22
- if (!l) {
23
- io.err(`No data entry for "${field}". Name a field as Entry.field, such as Refund.amount_cents or payments.Refund.amount_cents.`);
24
- return 1;
25
- }
26
- io.out(options.json
27
- ? JSON.stringify({
28
- ...l,
29
- stored: Object.fromEntries(l.stored),
30
- classifications: Object.fromEntries(l.classifications),
31
- }, null, 2)
32
- : formatLineage(l));
33
- return 0;
34
- }
35
- /** `archdoc simulate <journey> --sample <file>`: the path a sample takes, and the records it writes. */
36
- export async function simulateCommand(journey, options, io) {
37
- const model = await load(options, io);
38
- if (!model)
39
- return 1;
40
- let sample = {};
41
- if (options.sample) {
42
- try {
43
- const parsed = parse(await readFile(resolve(io.cwd, options.sample), "utf8"));
44
- if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) {
45
- throw new Error("it should map data entries to records, such as { RefundRequest: { amount_cents: 400 } }");
46
- }
47
- sample = parsed;
48
- }
49
- catch (err) {
50
- io.err(`Couldn't read ${options.sample}: ${err instanceof Error ? err.message : String(err)}`);
51
- return 2;
52
- }
53
- }
54
- const result = simulate(model, journey, sample);
55
- if (!result) {
56
- io.err(`No journey "${journey}". List them with "archdoc search <words>" or "archdoc show <journey>".`);
57
- return 1;
58
- }
59
- io.out(options.json ? JSON.stringify(result, null, 2) : formatSimulation(result));
60
- // Problems (a missing input, an expression that failed) fail the run, so CI can use it.
61
- return result.steps.some((s) => s.problems.length) ? 1 : 0;
62
- }
63
- //# sourceMappingURL=data.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"data.js","sourceRoot":"","sources":["../../src/commands/data.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EACL,aAAa,EACb,gBAAgB,EAChB,SAAS,EAET,OAAO,EACP,SAAS,EACT,QAAQ,GACT,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,KAAK,EAAE,MAAM,MAAM,CAAC;AAQ7B,KAAK,UAAU,IAAI,CAAC,OAAoB,EAAE,EAAM;IAC9C,MAAM,KAAK,GAAG,MAAM,SAAS,CAAC,OAAO,CAAC,KAAK,IAAI,GAAG,EAAE,EAAE,GAAG,EAAE,EAAE,CAAC,GAAG,EAAE,CAAC,CAAC;IACrE,IAAI,KAAK,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,iBAAiB,CAAC,EAAE,CAAC;QAChE,EAAE,CAAC,GAAG,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC,C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