@pmelab/gtd 60.0.0 → 61.0.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/.claude-plugin/plugin.json +1 -1
- package/README.md +21 -2
- package/dist/chunks/testkit-C9sq0x07.mjs +30758 -0
- package/dist/chunks/{wire-DZ8R1RU9.mjs → wire-CPNSm_9N.mjs} +27 -12
- package/dist/gtd.bundle.mjs +12238 -20706
- package/dist/gtd.core.mjs +593 -0
- package/dist/testkit/gherkin.mjs +2 -2
- package/dist/testkit.mjs +1 -1
- package/dist/wire.mjs +2 -2
- package/package.json +7 -7
- package/src/cli/Cli.test.ts +2 -2
- package/src/cli/Cli.ts +68 -51
- package/src/cli/History.test.ts +10 -1
- package/src/cli/Metrics.test.ts +10 -1
- package/src/cli/Output.test.ts +1 -1
- package/src/cli/Output.ts +3 -2
- package/src/cli/Program.test.ts +44 -25
- package/src/cli/Program.ts +39 -11
- package/src/cli/Strays.ts +3 -2
- package/src/cli/ToolCommands.ts +2 -2
- package/src/edge/Edge.test.ts +86 -31
- package/src/edge/Edge.ts +164 -31
- package/src/emit/GitScript.ts +21 -3
- package/src/emit/index.ts +3 -0
- package/src/flows/runtime.ts +1 -1
- package/src/gherkin/messages.test.ts +1 -0
- package/src/gherkin/module-config.feature +1 -0
- package/src/gherkin/more-steps.feature +1 -0
- package/src/gherkin/testkit.feature +2 -1
- package/src/install/Install.ts +9 -2
- package/src/install/Version.ts +9 -3
- package/src/install/index.ts +1 -1
- package/src/platform/CommandRunner.ts +13 -11
- package/src/platform/Commentary.ts +2 -2
- package/src/platform/Git.test.ts +4 -5
- package/src/platform/Git.ts +42 -38
- package/src/platform/Host.ts +1 -1
- package/src/platform/NodeServices.ts +11 -0
- package/src/platform/Workspace.test.ts +4 -5
- package/src/platform/Workspace.ts +3 -3
- package/src/platform/WorktreeState.test.ts +2 -3
- package/src/platform/WorktreeState.ts +1 -1
- package/src/platform/index.ts +2 -1
- package/src/replay/Format.test.ts +35 -8
- package/src/replay/Format.ts +7 -4
- package/src/replay/Replay.test.ts +54 -0
- package/src/replay/Replay.ts +61 -17
- package/src/replay/Trailers.test.ts +12 -12
- package/src/replay/Trailers.ts +35 -20
- package/src/replay/Tree.ts +11 -0
- package/src/replay/index.ts +3 -0
- package/src/step/LandStep.ts +1 -0
- package/src/step/RepoSnapshot.ts +2 -0
- package/src/step/planStart.test.ts +2 -2
- package/src/step/planStart.ts +3 -3
- package/src/step/planStep.test.ts +4 -4
- package/src/step/planStep.ts +10 -8
- package/src/testkit/TestRepo.test.ts +4 -1
- package/src/testkit/TestRepo.ts +3 -1
- package/src/twins/EmittedScriptRecognizer.ts +32 -1
- package/src/twins/EmittedScripts.test.ts +1 -1
- package/src/twins/GitTiers.ts +29 -7
- package/src/twins/InMemRepo.ts +14 -0
- package/src/twins/Layers.test.ts +1 -1
- package/src/twins/Layers.ts +10 -3
- package/src/twins/PinBeats.ts +33 -0
- package/src/twins/cliIo.ts +9 -4
- package/src/twins/index.ts +1 -0
- package/src/wire/BeatDocument.ts +26 -5
- package/src/wire/Demand.ts +16 -6
- package/src/wire/constants.ts +3 -0
- package/src/wire/types.ts +4 -0
- package/src/workflow/discovery.test.ts +24 -7
- package/src/workflow/discovery.ts +5 -6
- package/src/workflow/index.ts +1 -0
- package/src/workflow/load.test.ts +60 -3
- package/src/workflow/load.ts +316 -166
- package/src/workflow/pin.test.ts +159 -0
- package/src/workflow/pin.ts +72 -0
- package/src/workflow/vars.ts +3 -3
- package/dist/chunks/testkit-BvecVjQ0.mjs +0 -32355
|
@@ -4,8 +4,7 @@ import { join } from "node:path"
|
|
|
4
4
|
import { tmpdir } from "node:os"
|
|
5
5
|
import { afterEach, beforeEach, describe, expect, it } from "vitest"
|
|
6
6
|
import { Cause, Effect, Exit, Layer } from "effect"
|
|
7
|
-
import {
|
|
8
|
-
import { Narrator, GitService, Host, Workspace } from "../platform/index.js"
|
|
7
|
+
import { Narrator, GitService, Host, Workspace, NodeServices } from "../platform/index.js"
|
|
9
8
|
import {
|
|
10
9
|
ConfigDiscovery,
|
|
11
10
|
ConfigService,
|
|
@@ -23,7 +22,7 @@ type Env = Readonly<Record<string, string>>
|
|
|
23
22
|
|
|
24
23
|
const baseLayer = (dir: string, env: Env = {}) => {
|
|
25
24
|
const hostLayer = Host.layer({ root: dir, home: homeDir, env })
|
|
26
|
-
const gitLayer = GitService.Live.pipe(Layer.provide(Layer.merge(hostLayer,
|
|
25
|
+
const gitLayer = GitService.Live.pipe(Layer.provide(Layer.merge(hostLayer, NodeServices.layer)))
|
|
27
26
|
const workspaceLayer = Workspace.Live.pipe(Layer.provide(Layer.merge(hostLayer, gitLayer)))
|
|
28
27
|
return Layer.mergeAll(hostLayer, gitLayer, workspaceLayer)
|
|
29
28
|
}
|
|
@@ -442,6 +441,64 @@ describe("ConfigService", () => {
|
|
|
442
441
|
expect(Object.keys(cfg.fingerprint).sort()).toEqual(["gtd.config.ts", "steps.ts"])
|
|
443
442
|
})
|
|
444
443
|
|
|
444
|
+
it("an ES module package gets the shipped gtd, a CommonJS one stays Node's, each module keeps its location", async () => {
|
|
445
|
+
const vendor = join(projectDir, "vendor", "wf")
|
|
446
|
+
const pkg = (name: string, manifest: object, file: string, source: string) => {
|
|
447
|
+
const dir = join(vendor, "node_modules", name)
|
|
448
|
+
mkdirSync(dir, { recursive: true })
|
|
449
|
+
writeFileSync(join(dir, "package.json"), JSON.stringify({ name, ...manifest }))
|
|
450
|
+
writeFileSync(join(dir, file), source)
|
|
451
|
+
}
|
|
452
|
+
// No @pmelab/gtd installed: only the shipped copy can serve this import.
|
|
453
|
+
pkg(
|
|
454
|
+
"dep",
|
|
455
|
+
{ type: "module", exports: { import: "./index.js" } },
|
|
456
|
+
"index.js",
|
|
457
|
+
`import { human } from "@pmelab/gtd/flows"\nexport const file = typeof human\n`,
|
|
458
|
+
)
|
|
459
|
+
pkg("ts-dep", { main: "index.ts" }, "index.ts", `export const suffix: string = "ts"\n`)
|
|
460
|
+
pkg("cjs-dep", {}, "index.js", `module.exports = require("node:path").basename(__dirname)\n`)
|
|
461
|
+
writeFileSync(
|
|
462
|
+
join(vendor, "index.ts"),
|
|
463
|
+
[
|
|
464
|
+
`import { basename, dirname } from "node:path"`,
|
|
465
|
+
`import { fileURLToPath } from "node:url"`,
|
|
466
|
+
`import { file as base } from "dep"`,
|
|
467
|
+
`import { suffix } from "ts-dep"`,
|
|
468
|
+
`import cjs from "cjs-dep"`,
|
|
469
|
+
`const where = basename(dirname(fileURLToPath(import.meta.url)))`,
|
|
470
|
+
`export const file = [base, suffix, cjs, where].join("-")`,
|
|
471
|
+
``,
|
|
472
|
+
].join("\n"),
|
|
473
|
+
)
|
|
474
|
+
writeFileSync(
|
|
475
|
+
join(projectDir, "gtd.config.ts"),
|
|
476
|
+
[
|
|
477
|
+
`import { file } from "./vendor/wf/index.js"`,
|
|
478
|
+
optionedWorkflow("first", "{ steering: { [`.gtd/${file}.md`]: 'qa' } }"),
|
|
479
|
+
].join("\n"),
|
|
480
|
+
)
|
|
481
|
+
|
|
482
|
+
const cfg = await getConfig()
|
|
483
|
+
|
|
484
|
+
expect(cfg.workflow.steering[".gtd/function-ts-cjs-dep-wf.md"]).toBe("qa")
|
|
485
|
+
expect(Object.keys(cfg.fingerprint).sort()).toEqual(["gtd.config.ts", "vendor/wf/index.ts"])
|
|
486
|
+
})
|
|
487
|
+
|
|
488
|
+
it("a config may require and require.resolve a local module", async () => {
|
|
489
|
+
writeFileSync(join(projectDir, "steps.ts"), `export const file = "required"\n`)
|
|
490
|
+
writeFileSync(
|
|
491
|
+
join(projectDir, "gtd.config.ts"),
|
|
492
|
+
[
|
|
493
|
+
`const { file } = require("./steps.js")`,
|
|
494
|
+
`const found = require("node:path").basename(require.resolve("./steps.ts"))`,
|
|
495
|
+
optionedWorkflow("first", "{ steering: { [`.gtd/${file}-${found}.md`]: 'qa' } }"),
|
|
496
|
+
].join("\n"),
|
|
497
|
+
)
|
|
498
|
+
|
|
499
|
+
expect((await getConfig()).workflow.steering[".gtd/required-steps.ts.md"]).toBe("qa")
|
|
500
|
+
})
|
|
501
|
+
|
|
445
502
|
it("the fingerprint covers gtd.config.ts but no gtd module it imports", async () => {
|
|
446
503
|
const cfg = await getConfig()
|
|
447
504
|
|