@pmelab/gtd 6.1.0 → 6.1.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/dist/gtd.bundle.mjs +24 -33
- package/docs/cli.md +2 -1
- package/docs/configuration.md +5 -4
- package/package.json +1 -1
package/dist/gtd.bundle.mjs
CHANGED
|
@@ -190291,6 +190291,21 @@ const SEARCH_PLACES = [
|
|
|
190291
190291
|
"gtd.config.yaml"
|
|
190292
190292
|
];
|
|
190293
190293
|
/**
|
|
190294
|
+
* The shared cosmiconfig explorer used by every config lookup. `searchStrategy:
|
|
190295
|
+
* 'none'` makes `.search(dir)` inspect only that single directory (no internal
|
|
190296
|
+
* walking), so callers drive the cwd→home walk themselves via `walkUp`.
|
|
190297
|
+
*/
|
|
190298
|
+
const makeExplorer = () => (0, import_dist.cosmiconfig)("gtd", {
|
|
190299
|
+
searchPlaces: SEARCH_PLACES,
|
|
190300
|
+
searchStrategy: "none",
|
|
190301
|
+
loaders: {
|
|
190302
|
+
noExt: yamlLoader,
|
|
190303
|
+
".json": jsonLoader,
|
|
190304
|
+
".yaml": yamlLoader,
|
|
190305
|
+
".yml": yamlLoader
|
|
190306
|
+
}
|
|
190307
|
+
});
|
|
190308
|
+
/**
|
|
190294
190309
|
* Load and deep-merge every config level from cwd up the directory chain.
|
|
190295
190310
|
* Innermost (cwd) wins. Returns the merged plain object (undecoded).
|
|
190296
190311
|
*/
|
|
@@ -190298,16 +190313,7 @@ const loadMerged = (root) => tryPromise({
|
|
|
190298
190313
|
try: async () => {
|
|
190299
190314
|
const home = homedir();
|
|
190300
190315
|
const chain = walkUp(root, home);
|
|
190301
|
-
const explorer = (
|
|
190302
|
-
searchPlaces: SEARCH_PLACES,
|
|
190303
|
-
searchStrategy: "none",
|
|
190304
|
-
loaders: {
|
|
190305
|
-
noExt: yamlLoader,
|
|
190306
|
-
".json": jsonLoader,
|
|
190307
|
-
".yaml": yamlLoader,
|
|
190308
|
-
".yml": yamlLoader
|
|
190309
|
-
}
|
|
190310
|
-
});
|
|
190316
|
+
const explorer = makeExplorer();
|
|
190311
190317
|
const levels = [];
|
|
190312
190318
|
for (let i = chain.length - 1; i >= 0; i--) {
|
|
190313
190319
|
const dir = chain[i];
|
|
@@ -190322,30 +190328,15 @@ const loadMerged = (root) => tryPromise({
|
|
|
190322
190328
|
catch: (e) => e instanceof Error ? e : new Error(String(e))
|
|
190323
190329
|
});
|
|
190324
190330
|
/**
|
|
190325
|
-
*
|
|
190326
|
-
*
|
|
190327
|
-
*
|
|
190328
|
-
*
|
|
190331
|
+
* Detect whether a gtd config lives at THIS single directory — no `walkUp`, so
|
|
190332
|
+
* a global `~/.gtdrc` or an ancestor project's config does NOT count. Exported
|
|
190333
|
+
* so `gtd init` (src/program.ts) refuses only when it would overwrite the
|
|
190334
|
+
* repo's OWN config, not when a global default layer merely exists upstream.
|
|
190329
190335
|
*/
|
|
190330
|
-
const
|
|
190336
|
+
const configPresentAt = (dir) => tryPromise({
|
|
190331
190337
|
try: async () => {
|
|
190332
|
-
const
|
|
190333
|
-
|
|
190334
|
-
const explorer = (0, import_dist.cosmiconfig)("gtd", {
|
|
190335
|
-
searchPlaces: SEARCH_PLACES,
|
|
190336
|
-
searchStrategy: "none",
|
|
190337
|
-
loaders: {
|
|
190338
|
-
noExt: yamlLoader,
|
|
190339
|
-
".json": jsonLoader,
|
|
190340
|
-
".yaml": yamlLoader,
|
|
190341
|
-
".yml": yamlLoader
|
|
190342
|
-
}
|
|
190343
|
-
});
|
|
190344
|
-
for (const dir of chain) {
|
|
190345
|
-
const result = await explorer.search(dir);
|
|
190346
|
-
if (result && !result.isEmpty) return true;
|
|
190347
|
-
}
|
|
190348
|
-
return false;
|
|
190338
|
+
const result = await makeExplorer().search(dir);
|
|
190339
|
+
return Boolean(result && !result.isEmpty);
|
|
190349
190340
|
},
|
|
190350
190341
|
catch: (e) => e instanceof Error ? e : new Error(String(e))
|
|
190351
190342
|
});
|
|
@@ -204314,7 +204305,7 @@ const runInitCommand = (argv, json, write) => gen(function* () {
|
|
|
204314
204305
|
const fs = yield* FileSystem;
|
|
204315
204306
|
yield* assertRunningFromRepoRoot(git, fs);
|
|
204316
204307
|
const { root } = yield* Cwd;
|
|
204317
|
-
if (yield*
|
|
204308
|
+
if (yield* configPresentAt(root)) return yield* fail$2(/* @__PURE__ */ new Error("gtd init: a gtd config already exists — remove it before re-initializing"));
|
|
204318
204309
|
yield* fs.writeFileString(join(root, ".gtdrc.json"), renderInitConfig(name)).pipe(mapError$1((e) => e instanceof Error ? e : new Error(String(e))));
|
|
204319
204310
|
if (json) write(JSON.stringify({
|
|
204320
204311
|
written: ".gtdrc.json",
|
package/docs/cli.md
CHANGED
|
@@ -73,7 +73,8 @@ fails with `gtd: no workflow configured — run \`gtd init <simple|advanced>\`
|
|
|
73
73
|
|
|
74
74
|
The file is written **uncommitted**; review and commit it before your first
|
|
75
75
|
`gtd step` (an uncommitted `.gtdrc.json` is a pending change the initial state
|
|
76
|
-
would otherwise capture). `gtd init` refuses if
|
|
76
|
+
would otherwise capture). `gtd init` refuses if the repo root already has its
|
|
77
|
+
own gtd config (a global/ancestor config, e.g. `~/.gtdrc`, does not count),
|
|
77
78
|
requires the repository root, and — with `gtd lsp` — is one of the two commands
|
|
78
79
|
that run with no workflow configured. `--json` prints
|
|
79
80
|
`{"written":".gtdrc.json","workflow":"<name>"}`. See
|
package/docs/configuration.md
CHANGED
|
@@ -668,10 +668,11 @@ chosen bundled template's whole workflow inline under a `workflow:` key, plus a
|
|
|
668
668
|
|
|
669
669
|
The file is written **uncommitted** — review it, then commit it before your
|
|
670
670
|
first `gtd step` (an uncommitted `.gtdrc.json` is a pending change the initial
|
|
671
|
-
state's `* **` edge would otherwise capture). `gtd init` refuses if
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
671
|
+
state's `* **` edge would otherwise capture). `gtd init` refuses if the repo
|
|
672
|
+
root already has its OWN gtd config (remove it first to re-init; a
|
|
673
|
+
global/ancestor config such as `~/.gtdrc` does not count), requires the
|
|
674
|
+
repository root, and is one of the two commands (with `gtd lsp`) that run with
|
|
675
|
+
no workflow configured. A state command run before `gtd init` fails with:
|
|
675
676
|
|
|
676
677
|
```
|
|
677
678
|
gtd: no workflow configured — run `gtd init <simple|advanced>` to create .gtdrc.json
|