filegrc 0.4.0 → 0.5.1

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/README.md CHANGED
@@ -34,15 +34,23 @@ npx filegrc prepare-audit audit-id
34
34
  npx filegrc evidence-packet --start 2026-01-01 --end 2026-06-30 --audit audit-id
35
35
  ```
36
36
 
37
- ## Upgrade a model v1 workspace
37
+ ## Upgrade an existing workspace
38
38
 
39
- The normal runtime uses data model v2. A model v1 workspace must be migrated before other commands can change it. Start with a read-only preview:
39
+ The normal runtime uses data model v3. Start a model v2 upgrade with a read-only preview:
40
+
41
+ ```sh
42
+ npx filegrc migrate --to-model 3 --preview --json
43
+ ```
44
+
45
+ Review every automatic, review-required, and unsupported item. Resolve unsupported items before applying the same migration with `--yes`. The migration writes one atomic batch, validates model v3, changes no Git history, and is safe to rerun. The [model v3 upgrade guide](https://github.com/Alignbase/filegrc/blob/main/docs/upgrading-to-model-v3.md) explains every migration class and the review that follows.
46
+
47
+ A model v1 workspace must migrate to v2 first:
40
48
 
41
49
  ```sh
42
50
  npx filegrc migrate --to-model 2 --preview --json
43
51
  ```
44
52
 
45
- Resolve every item in `missing`, `conflicts`, and `manualActions`. Then rerun the same command with `--yes`. The migration writes one atomic batch, validates model v2, changes no Git history, and is safe to rerun. The [model v2 upgrade guide](https://github.com/Sunpeak-AI/filegrc/blob/main/docs/upgrading-to-model-v2.md) lists every field mapping and review step.
53
+ Follow the [model v2 upgrade guide](https://github.com/Alignbase/filegrc/blob/main/docs/upgrading-to-model-v2.md), then run the model v3 preview.
46
54
 
47
55
  `filegrc serve --help` prints bind, port, environment, and safety options without starting the server. The editable server defaults to `127.0.0.1:8787`; set `FILEGRC_HOST`, `FILEGRC_PORT`, or the matching flags when needed. In trunk mode, browser saves synchronize, commit, and push from the authoritative branch. Use `--allow-non-authoritative-writes` for local development in a task checkout; the override never commits or pushes.
48
56
 
package/model/index.js CHANGED
@@ -1,14 +1,18 @@
1
1
  import { readFileSync } from "node:fs";
2
2
 
3
- export function loadModel(version = "2") {
3
+ export const ACTIVE_MODEL_VERSION = "3";
4
+ export const SUPPORTED_MODEL_VERSIONS = Object.freeze(["2", ACTIVE_MODEL_VERSION]);
5
+
6
+ export function loadModel(version = ACTIVE_MODEL_VERSION) {
4
7
  const requested = String(version);
5
- if (requested !== "2") {
8
+ if (!SUPPORTED_MODEL_VERSIONS.includes(requested)) {
9
+ const migrationTarget = requested === "1" ? "2" : "3";
6
10
  throw new Error(
7
- `Unsupported data model version "${requested}". This filegrc release uses model v2. `
8
- + "Run `npx filegrc migrate --to-model 2 --preview --json` from the workspace root."
11
+ `Unsupported data model version "${requested}". This filegrc release supports models v2 and v3. `
12
+ + `Run \`npx filegrc migrate --to-model ${migrationTarget} --preview --json\` from the workspace root.`
9
13
  );
10
14
  }
11
- const model = JSON.parse(readFileSync(new URL("./v2.json", import.meta.url), "utf8"));
15
+ const model = JSON.parse(readFileSync(new URL(`./v${requested}.json`, import.meta.url), "utf8"));
12
16
  for (const [type, definition] of Object.entries(model.resources)) {
13
17
  for (const [name, field] of Object.entries({ ...model.commonFields, ...definition.fields })) {
14
18
  expandRegistryReference(model, field, `${type}.${name}`);