@miadi/stateloom-mcp 0.1.2 → 0.1.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.
@@ -1,47 +0,0 @@
1
- /**
2
- * Path power (HANDOFF v2, Phase 2 deliverable 1): the pure logic behind the
3
- * `set_project_file` MCP tool. An agent may point the loom at any `.json`
4
- * document path; the switch must absolute-resolve the path, report whether a
5
- * file is already there (missing is legitimate — create_state_machine writes
6
- * it next), and refuse non-JSON paths outright.
7
- */
8
- import { test } from "node:test";
9
- import assert from "node:assert/strict";
10
- import { mkdtempSync, writeFileSync, rmSync } from "node:fs";
11
- import { join, resolve } from "node:path";
12
- import { tmpdir } from "node:os";
13
- import { resolveProjectSwitch } from "../projectSwitch.js";
14
-
15
- test("projectSwitch: relative path resolves absolute and previous is carried", () => {
16
- const r = resolveProjectSwitch("./some/machine.smdf.json", "/prev/doc.smdf.json");
17
- assert.equal(r.path, resolve("./some/machine.smdf.json"));
18
- assert.equal(r.previous, "/prev/doc.smdf.json");
19
- assert.equal(r.exists, false);
20
- });
21
-
22
- test("projectSwitch: reports exists=true for a file already on disk", () => {
23
- const dir = mkdtempSync(join(tmpdir(), "loom-switch-"));
24
- const file = join(dir, "episode.smdf.json");
25
- writeFileSync(file, JSON.stringify({ stateMachine: { settings: {}, events: [], state: { name: "Root" } } }));
26
- try {
27
- const r = resolveProjectSwitch(file, "/prev/doc.smdf.json");
28
- assert.equal(r.path, file);
29
- assert.equal(r.exists, true);
30
- } finally {
31
- rmSync(dir, { recursive: true, force: true });
32
- }
33
- });
34
-
35
- test("projectSwitch: refuses a non-.json path", () => {
36
- assert.throws(
37
- () => resolveProjectSwitch("/tmp/machine.yaml", "/prev/doc.smdf.json"),
38
- /\.json/,
39
- );
40
- });
41
-
42
- test("projectSwitch: switching to the same path is allowed and reports it", () => {
43
- const r = resolveProjectSwitch("/prev/doc.smdf.json", "/prev/doc.smdf.json");
44
- assert.equal(r.path, "/prev/doc.smdf.json");
45
- assert.equal(r.previous, "/prev/doc.smdf.json");
46
- assert.equal(r.unchanged, true);
47
- });
package/tsconfig.json DELETED
@@ -1,15 +0,0 @@
1
- {
2
- "compilerOptions": {
3
- "target": "ES2022",
4
- "module": "NodeNext",
5
- "moduleResolution": "NodeNext",
6
- "outDir": "dist",
7
- "rootDir": "src",
8
- "strict": true,
9
- "declaration": true,
10
- "esModuleInterop": true,
11
- "skipLibCheck": true,
12
- "forceConsistentCasingInFileNames": true
13
- },
14
- "include": ["src"]
15
- }