dev-cockpit 0.2.1 → 0.2.2
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/CHANGELOG.md +58 -0
- package/README.md +22 -0
- package/dist/buildCli.d.ts.map +1 -1
- package/dist/chunk-C4GFJDMG.js +79 -0
- package/dist/chunk-C4GFJDMG.js.map +7 -0
- package/dist/commands/dev.d.ts.map +1 -1
- package/dist/commands/doctor.d.ts.map +1 -1
- package/dist/commands/init-config.d.ts +2 -0
- package/dist/commands/init-config.d.ts.map +1 -1
- package/dist/commands/link.d.ts +20 -0
- package/dist/commands/link.d.ts.map +1 -0
- package/dist/commands/mount.d.ts.map +1 -1
- package/dist/core/config-discovery.d.ts +39 -0
- package/dist/core/config-discovery.d.ts.map +1 -0
- package/dist/core/manifest.d.ts +47 -0
- package/dist/core/manifest.d.ts.map +1 -0
- package/dist/index.js +244 -137
- package/dist/index.js.map +4 -4
- package/dist/link-HXNII7EU.js +65 -0
- package/dist/link-HXNII7EU.js.map +7 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,64 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to `dev-cockpit` are documented here. The format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/) and the project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
4
4
|
|
|
5
|
+
## [0.2.2] — 2026-05-12
|
|
6
|
+
|
|
7
|
+
External `cockpit.yaml` — the config can now live anywhere, with a per-machine registry mapping workspaces to their YAML file.
|
|
8
|
+
|
|
9
|
+
### Added
|
|
10
|
+
|
|
11
|
+
- **`cockpit.yaml` discovery chain.** Resolves in this order: `--config <path>` CLI flag → `DEV_COCKPIT_CONFIG` env var → `<cwd>/cockpit.yaml` → `$XDG_DATA_HOME/dev-cockpit/manifest.json` lookup keyed by canonical `cwd` → friendly error pointing at `dev-cockpit link`. Lets the config live outside the workspace without losing the "just run from the workspace root" UX.
|
|
12
|
+
- **`dev-cockpit link` subcommand tree.** `link <config-path>` registers the current directory in the manifest; `link list` prints all mappings sorted by workspace; `link remove` unregisters the current directory. Atomic write (`.tmp` + rename), symlink-canonical keys (so `~/work` and `/Volumes/.../work` hash to the same entry).
|
|
13
|
+
- **`init-config -o, --output <path>`.** Write the starter config anywhere, not just `<cwd>/cockpit.yaml`. Honours the existing `cwd` parameter as the anchor when `--output` is relative.
|
|
14
|
+
- **`DEV_COCKPIT_CONFIG` env var** picked up by all commands as the second-precedence fallback.
|
|
15
|
+
- **`src/core/manifest.ts`** — read / lookup / atomic write of the project→config map. Defensive: returns `null` for missing / malformed / wrong-version files (treated as "not registered yet" rather than an error).
|
|
16
|
+
- **`src/core/config-discovery.ts`** — pure resolver returning `{ configPath, workspaceRoot, source }`. Profile `discoverer` hook still overrides `workspaceRoot` (e.g. awc-cockpit walks up to find the wrapper); generic users get `canonical(cwd)`.
|
|
17
|
+
|
|
18
|
+
### Changed
|
|
19
|
+
|
|
20
|
+
- **`dev` / `doctor` / `mount` (+ `status`, `clear`) now derive workspace from `canonical(cwd)`**, not `path.dirname(configPath)`. So `--config /tmp/x.yaml` from inside a wrapper keeps the workspace as the wrapper — the whole point of external configs.
|
|
21
|
+
- **`-c, --config` no longer defaults to `'cockpit.yaml'`** at the Commander level. Default is `undefined` so the discovery chain sees the "no explicit flag" signal and walks the precedence list. Help text describes the fallback chain.
|
|
22
|
+
|
|
23
|
+
### Fixed
|
|
24
|
+
|
|
25
|
+
- **CI publish workflow.** `npm install -g npm@latest` on Node 22's bundled npm could leave global state where `Cannot find module 'promise-retry'` fires from the half-installed npm. Switched the publish workflow to Node 24, which ships npm 11.x natively (satisfies the npm Trusted Publishing >= 11.5.1 requirement without a self-upgrade).
|
|
26
|
+
|
|
27
|
+
## [0.2.1] — 2026-05-11
|
|
28
|
+
|
|
29
|
+
Post-1.0 roadmap landing: action registry, processes (renamed from watchers), repos pane redesign, profile wizardSteps, accessibility (severity glyph + NO_COLOR), narrow-terminal responsiveness, lift-mount + bundled dist, plus a wave of fit-and-finish.
|
|
30
|
+
|
|
31
|
+
### Added
|
|
32
|
+
|
|
33
|
+
- **Action registry** with `:` command palette. `ActionConfig` has `id`, `label`, `scope` (`global` | `repos` | `repos:<id>`), `key` (single char), and a programmatic `invoke` callback. Replaces the legacy Repos `r/w/l` hardcoding — the Footer derives its legend from the registry, so profile-defined actions show up automatically.
|
|
34
|
+
- **`Profile.wizardSteps` extension point.** Profiles inject custom steps into `init-config -i` (e.g. awc-cockpit asks for `gitlab.host` + `gitlab.topic` during the wizard).
|
|
35
|
+
- **`defaultPane` config field** (`repos | output | health | help`). Profile-overridable.
|
|
36
|
+
- **Processes (renamed from watchers).** `config.processes[]` is the new spelling; old `config.watchers[]` is auto-migrated via the new schema migration tooling on load. `CONFIG_VERSION` bumped 1 → 2.
|
|
37
|
+
- **`dev-cockpit migrate-config`** persists the in-memory v1 → v2 migration to disk.
|
|
38
|
+
- **Repos pane redesign.** Split layout: row list on the left, per-row action panel on the right. Process-kind rows with built-in `r → restart` actions wired through the action registry. Grouped list (Repos / Docker / Processes subheadings) for navigability.
|
|
39
|
+
- **`dev-cockpit doctor --paths`** prints state-dir paths in `KEY=PATH` form (eval-friendly).
|
|
40
|
+
- **`subprocess` tag lookup.** `spawnStream({ tag })` registers the handle in a `BY_TAG` map; `findSpawnedByTag(tag)` / `killSpawnedByTag(tag)` look it up. Used by per-process restart actions.
|
|
41
|
+
- **`spawnStream` stdin option.** Opt-in `stdin?: 'pipe' | 'ignore' | 'inherit'` on `SpawnOptions` — pass `'ignore'` for non-interactive subprocesses so any `read`/prompt in the child gets EOF instead of blocking forever on an unwritten pipe.
|
|
42
|
+
- **Severity glyph** at the start of every Output line — accessibility for users who run with `NO_COLOR=1`.
|
|
43
|
+
- **`NO_COLOR` full-strip** — every ANSI escape is filtered when the env var is set.
|
|
44
|
+
- **Narrow-terminal responsiveness.** `useTerminalWidth` hook; TabBar / Help / Repos collapse cleanly under ~200 cols (legend says `j/k` instead of arrows when collapsed).
|
|
45
|
+
- **Wizard auto-seeds `actions[]`** from `package.json` scripts during `init-config -i`.
|
|
46
|
+
- **Smart defaults** for health-check `id` + `label` in the wizard (derived from check type + target).
|
|
47
|
+
- **Container-running health predicate uses `docker ps --filter name=<value> --format {{.State}}`** — compose-aware naming, so `name: laravel.test` matches `crossroads-laravel.test-1`.
|
|
48
|
+
- **Engine guard.** Friendly error message when Node < 20.12.
|
|
49
|
+
|
|
50
|
+
### Changed
|
|
51
|
+
|
|
52
|
+
- **`Repos` pane label → `Targets`** (display only; internal enum stays `repos`).
|
|
53
|
+
- **Mount machinery lifted into dev-cockpit core.** `mountCandidatesProvider` + `mountSymlinks` + `onMountApply` / `onMountClear` hooks on `Profile`; awc-cockpit kept its own `mount` command for its richer interactive UX (composer-aware clear semantics).
|
|
54
|
+
- **Bundled dist.** esbuild produces a single self-contained `dist/index.js` + helpers; consumer installs no longer need to resolve dev-cockpit's full source tree.
|
|
55
|
+
- **OIDC trusted publishing** on the publish workflow. No more `NODE_AUTH_TOKEN` — npm verifies the GitHub OIDC token issued by the workflow's `id-token: write` permission.
|
|
56
|
+
|
|
57
|
+
### Fixed
|
|
58
|
+
|
|
59
|
+
- **`killSpawnedByTag` race.** Promise.race against the exitCode + a SIGKILL guard could return before the `BY_TAG` finalizer ran on slower CI runners. Now awaits `exitCode` unconditionally after the race so the finalizer completes before return.
|
|
60
|
+
- **Repos pane title duplication** — dropped the redundant pane title; TabBar already labels the tab.
|
|
61
|
+
- **Wizard Repos step copy** — reflects the post-redesign reality (action panel + grouped list).
|
|
62
|
+
|
|
5
63
|
## [0.1.0] — 2026-05-10
|
|
6
64
|
|
|
7
65
|
First pre-1.0 release. The public surface (`Profile` interface with `boot` lifecycle hook, `buildCli`, the four core commands `dev / doctor / init-config / mount`, the `cockpit.yaml` schema with `version: 1`) is stable enough for first consumers to depend on. Expect minor churn until the post-1.0 roadmap items land.
|
package/README.md
CHANGED
|
@@ -93,6 +93,28 @@ notifications:
|
|
|
93
93
|
|
|
94
94
|
Wrappers upgrading from v1 (pre-rename) configs run `dev-cockpit migrate-config` to persist the v1 → v2 migration (auto-applied in memory on load with a stderr warning).
|
|
95
95
|
|
|
96
|
+
## Config discovery
|
|
97
|
+
|
|
98
|
+
dev-cockpit resolves cockpit.yaml in this order:
|
|
99
|
+
|
|
100
|
+
1. `--config <path>` CLI flag
|
|
101
|
+
2. `DEV_COCKPIT_CONFIG` env var
|
|
102
|
+
3. `<cwd>/cockpit.yaml`
|
|
103
|
+
4. `$XDG_DATA_HOME/dev-cockpit/manifest.json` lookup keyed by canonical `cwd`
|
|
104
|
+
|
|
105
|
+
All paths inside cockpit.yaml resolve against the **workspace** (your cwd, or whatever a profile's `discoverer`
|
|
106
|
+
returns) — never against the config file's directory. Lets one config serve multiple wrappers without rewriting
|
|
107
|
+
paths.
|
|
108
|
+
|
|
109
|
+
To use a config that lives outside your project:
|
|
110
|
+
|
|
111
|
+
cd ~/code/my-wrapper
|
|
112
|
+
dev-cockpit link ~/configs/my-wrapper.cockpit.yaml
|
|
113
|
+
dev-cockpit dev # picks up the mapping
|
|
114
|
+
|
|
115
|
+
dev-cockpit link list # show all mappings
|
|
116
|
+
dev-cockpit link remove # unregister the current cwd
|
|
117
|
+
|
|
96
118
|
## Profiles
|
|
97
119
|
|
|
98
120
|
A profile is a domain-specific bundle that plugs into dev-cockpit's lifecycle. It contributes any combination of:
|
package/dist/buildCli.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"buildCli.d.ts","sourceRoot":"","sources":["../src/buildCli.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAIpC,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAW/C,MAAM,WAAW,eAAe;
|
|
1
|
+
{"version":3,"file":"buildCli.d.ts","sourceRoot":"","sources":["../src/buildCli.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAIpC,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAW/C,MAAM,WAAW,eAAe;IAC/B,OAAO,CAAC,EAAE,OAAO,CAAC;CAClB;AAkBD,wBAAgB,QAAQ,CAAC,IAAI,GAAE,eAAoB,GAAG,OAAO,CA6I5D"}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { createRequire as __createRequireDC } from 'node:module';
|
|
2
|
+
const require = __createRequireDC(import.meta.url);
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
// src/core/manifest.ts
|
|
6
|
+
import fs from "node:fs";
|
|
7
|
+
import os from "node:os";
|
|
8
|
+
import path from "node:path";
|
|
9
|
+
var MANIFEST_VERSION = 1;
|
|
10
|
+
function manifestPath() {
|
|
11
|
+
const xdgDataHome = process.env["XDG_DATA_HOME"] || path.join(os.homedir(), ".local", "share");
|
|
12
|
+
return path.join(xdgDataHome, "dev-cockpit", "manifest.json");
|
|
13
|
+
}
|
|
14
|
+
function canonical(p) {
|
|
15
|
+
const abs = path.resolve(p);
|
|
16
|
+
try {
|
|
17
|
+
return fs.realpathSync(abs);
|
|
18
|
+
} catch {
|
|
19
|
+
return abs;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
function readManifest() {
|
|
23
|
+
const filePath = manifestPath();
|
|
24
|
+
if (!fs.existsSync(filePath)) return null;
|
|
25
|
+
try {
|
|
26
|
+
const raw = JSON.parse(fs.readFileSync(filePath, "utf8"));
|
|
27
|
+
if (raw.version !== MANIFEST_VERSION) return null;
|
|
28
|
+
if (!raw.projects || typeof raw.projects !== "object") return null;
|
|
29
|
+
const projects = {};
|
|
30
|
+
for (const [k, v] of Object.entries(raw.projects)) {
|
|
31
|
+
if (typeof k === "string" && typeof v === "string") projects[k] = v;
|
|
32
|
+
}
|
|
33
|
+
return { version: MANIFEST_VERSION, projects };
|
|
34
|
+
} catch {
|
|
35
|
+
return null;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
function lookupConfig(workspaceRoot) {
|
|
39
|
+
const m = readManifest();
|
|
40
|
+
if (!m) return null;
|
|
41
|
+
return m.projects[canonical(workspaceRoot)] ?? null;
|
|
42
|
+
}
|
|
43
|
+
function writeManifest(m) {
|
|
44
|
+
const filePath = manifestPath();
|
|
45
|
+
fs.mkdirSync(path.dirname(filePath), { recursive: true });
|
|
46
|
+
const tmp = `${filePath}.tmp`;
|
|
47
|
+
fs.writeFileSync(tmp, `${JSON.stringify(m, null, 2)}
|
|
48
|
+
`, "utf8");
|
|
49
|
+
fs.renameSync(tmp, filePath);
|
|
50
|
+
}
|
|
51
|
+
function setMapping(workspaceRoot, configPath) {
|
|
52
|
+
const existing = readManifest() ?? { version: MANIFEST_VERSION, projects: {} };
|
|
53
|
+
existing.projects[canonical(workspaceRoot)] = canonical(configPath);
|
|
54
|
+
writeManifest(existing);
|
|
55
|
+
}
|
|
56
|
+
function removeMapping(workspaceRoot) {
|
|
57
|
+
const existing = readManifest();
|
|
58
|
+
if (!existing) return false;
|
|
59
|
+
const key = canonical(workspaceRoot);
|
|
60
|
+
if (!(key in existing.projects)) return false;
|
|
61
|
+
delete existing.projects[key];
|
|
62
|
+
writeManifest(existing);
|
|
63
|
+
return true;
|
|
64
|
+
}
|
|
65
|
+
function listMappings() {
|
|
66
|
+
const m = readManifest();
|
|
67
|
+
if (!m) return [];
|
|
68
|
+
return Object.entries(m.projects).map(([workspace, config]) => ({ workspace, config })).sort((a, b) => a.workspace.localeCompare(b.workspace));
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
export {
|
|
72
|
+
manifestPath,
|
|
73
|
+
canonical,
|
|
74
|
+
lookupConfig,
|
|
75
|
+
setMapping,
|
|
76
|
+
removeMapping,
|
|
77
|
+
listMappings
|
|
78
|
+
};
|
|
79
|
+
//# sourceMappingURL=chunk-C4GFJDMG.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/core/manifest.ts"],
|
|
4
|
+
"sourcesContent": ["/**\n * Read/write the global project\u2192config manifest at\n * `$XDG_DATA_HOME/dev-cockpit/manifest.json`. Keys are canonical\n * absolute paths to a workspace root; values are absolute paths to\n * the cockpit.yaml that workspace should use.\n *\n * Used by core/config-discovery.ts as the last-resort lookup when\n * the workspace doesn't carry its own cockpit.yaml at the root.\n */\n\nimport fs from 'node:fs';\nimport os from 'node:os';\nimport path from 'node:path';\n\nconst MANIFEST_VERSION = 1 as const;\n\nexport interface Manifest {\n version: typeof MANIFEST_VERSION;\n projects: Record<string, string>;\n}\n\n/** Absolute path of `$XDG_DATA_HOME/dev-cockpit/manifest.json`. */\nexport function manifestPath(): string {\n // `||` (not `??`) so an empty-string env var falls through to the default.\n const xdgDataHome =\n process.env['XDG_DATA_HOME'] || path.join(os.homedir(), '.local', 'share');\n return path.join(xdgDataHome, 'dev-cockpit', 'manifest.json');\n}\n\n/**\n * Canonicalise an absolute path \u2014 resolves symlinks if the path exists,\n * falls back to `path.resolve()` otherwise. Ensures a symlinked workspace\n * dir (`~/work`) and its real target (`/Users/me/code/work`) hash to the\n * same manifest key.\n */\nexport function canonical(p: string): string {\n const abs = path.resolve(p);\n try {\n return fs.realpathSync(abs);\n } catch {\n return abs;\n }\n}\n\n/**\n * Read the manifest. Returns `null` when the file is missing, unreadable,\n * malformed JSON, or doesn't match the expected shape. Callers treat null\n * as \"no mapping registered\" rather than an error \u2014 the user simply\n * hasn't run `dev-cockpit link` yet.\n */\nexport function readManifest(): Manifest | null {\n const filePath = manifestPath();\n if (!fs.existsSync(filePath)) return null;\n try {\n const raw = JSON.parse(fs.readFileSync(filePath, 'utf8')) as Partial<Manifest>;\n if (raw.version !== MANIFEST_VERSION) return null;\n if (!raw.projects || typeof raw.projects !== 'object') return null;\n const projects: Record<string, string> = {};\n for (const [k, v] of Object.entries(raw.projects)) {\n if (typeof k === 'string' && typeof v === 'string') projects[k] = v;\n }\n return { version: MANIFEST_VERSION, projects };\n } catch {\n return null;\n }\n}\n\n/** Look up a workspace's config path. Returns `null` when unmapped. */\nexport function lookupConfig(workspaceRoot: string): string | null {\n const m = readManifest();\n if (!m) return null;\n return m.projects[canonical(workspaceRoot)] ?? null;\n}\n\n/**\n * Atomic write: serialise to `<file>.tmp` next to the manifest, then\n * rename onto the real path. Creates the parent dir if missing. Same\n * pattern used by dev-cockpit's mount-manifest writer.\n */\nfunction writeManifest(m: Manifest): void {\n const filePath = manifestPath();\n fs.mkdirSync(path.dirname(filePath), { recursive: true });\n const tmp = `${filePath}.tmp`;\n fs.writeFileSync(tmp, `${JSON.stringify(m, null, 2)}\\n`, 'utf8');\n fs.renameSync(tmp, filePath);\n}\n\n/**\n * Register a mapping. Both inputs are canonicalised first \u2014 the\n * workspace key is resolved through symlinks so a `~/work` symlink and\n * `/Users/me/code/work` real path resolve to the same entry.\n */\nexport function setMapping(workspaceRoot: string, configPath: string): void {\n const existing = readManifest() ?? { version: MANIFEST_VERSION, projects: {} };\n existing.projects[canonical(workspaceRoot)] = canonical(configPath);\n writeManifest(existing);\n}\n\n/** Remove a mapping. Returns `true` when an entry was deleted. */\nexport function removeMapping(workspaceRoot: string): boolean {\n const existing = readManifest();\n if (!existing) return false;\n const key = canonical(workspaceRoot);\n if (!(key in existing.projects)) return false;\n delete existing.projects[key];\n writeManifest(existing);\n return true;\n}\n\n/** Sorted mapping list, for `dev-cockpit link list`. */\nexport function listMappings(): Array<{ workspace: string; config: string }> {\n const m = readManifest();\n if (!m) return [];\n return Object.entries(m.projects)\n .map(([workspace, config]) => ({ workspace, config }))\n .sort((a, b) => a.workspace.localeCompare(b.workspace));\n}\n"],
|
|
5
|
+
"mappings": ";;;;;AAUA,OAAO,QAAQ;AACf,OAAO,QAAQ;AACf,OAAO,UAAU;AAEjB,IAAM,mBAAmB;AAQlB,SAAS,eAAuB;AAErC,QAAM,cACJ,QAAQ,IAAI,eAAe,KAAK,KAAK,KAAK,GAAG,QAAQ,GAAG,UAAU,OAAO;AAC3E,SAAO,KAAK,KAAK,aAAa,eAAe,eAAe;AAC9D;AAQO,SAAS,UAAU,GAAmB;AAC3C,QAAM,MAAM,KAAK,QAAQ,CAAC;AAC1B,MAAI;AACF,WAAO,GAAG,aAAa,GAAG;AAAA,EAC5B,QAAQ;AACN,WAAO;AAAA,EACT;AACF;AAQO,SAAS,eAAgC;AAC9C,QAAM,WAAW,aAAa;AAC9B,MAAI,CAAC,GAAG,WAAW,QAAQ,EAAG,QAAO;AACrC,MAAI;AACF,UAAM,MAAM,KAAK,MAAM,GAAG,aAAa,UAAU,MAAM,CAAC;AACxD,QAAI,IAAI,YAAY,iBAAkB,QAAO;AAC7C,QAAI,CAAC,IAAI,YAAY,OAAO,IAAI,aAAa,SAAU,QAAO;AAC9D,UAAM,WAAmC,CAAC;AAC1C,eAAW,CAAC,GAAG,CAAC,KAAK,OAAO,QAAQ,IAAI,QAAQ,GAAG;AACjD,UAAI,OAAO,MAAM,YAAY,OAAO,MAAM,SAAU,UAAS,CAAC,IAAI;AAAA,IACpE;AACA,WAAO,EAAE,SAAS,kBAAkB,SAAS;AAAA,EAC/C,QAAQ;AACN,WAAO;AAAA,EACT;AACF;AAGO,SAAS,aAAa,eAAsC;AACjE,QAAM,IAAI,aAAa;AACvB,MAAI,CAAC,EAAG,QAAO;AACf,SAAO,EAAE,SAAS,UAAU,aAAa,CAAC,KAAK;AACjD;AAOA,SAAS,cAAc,GAAmB;AACxC,QAAM,WAAW,aAAa;AAC9B,KAAG,UAAU,KAAK,QAAQ,QAAQ,GAAG,EAAE,WAAW,KAAK,CAAC;AACxD,QAAM,MAAM,GAAG,QAAQ;AACvB,KAAG,cAAc,KAAK,GAAG,KAAK,UAAU,GAAG,MAAM,CAAC,CAAC;AAAA,GAAM,MAAM;AAC/D,KAAG,WAAW,KAAK,QAAQ;AAC7B;AAOO,SAAS,WAAW,eAAuB,YAA0B;AAC1E,QAAM,WAAW,aAAa,KAAK,EAAE,SAAS,kBAAkB,UAAU,CAAC,EAAE;AAC7E,WAAS,SAAS,UAAU,aAAa,CAAC,IAAI,UAAU,UAAU;AAClE,gBAAc,QAAQ;AACxB;AAGO,SAAS,cAAc,eAAgC;AAC5D,QAAM,WAAW,aAAa;AAC9B,MAAI,CAAC,SAAU,QAAO;AACtB,QAAM,MAAM,UAAU,aAAa;AACnC,MAAI,EAAE,OAAO,SAAS,UAAW,QAAO;AACxC,SAAO,SAAS,SAAS,GAAG;AAC5B,gBAAc,QAAQ;AACtB,SAAO;AACT;AAGO,SAAS,eAA6D;AAC3E,QAAM,IAAI,aAAa;AACvB,MAAI,CAAC,EAAG,QAAO,CAAC;AAChB,SAAO,OAAO,QAAQ,EAAE,QAAQ,EAC7B,IAAI,CAAC,CAAC,WAAW,MAAM,OAAO,EAAE,WAAW,OAAO,EAAE,EACpD,KAAK,CAAC,GAAG,MAAM,EAAE,UAAU,cAAc,EAAE,SAAS,CAAC;AAC1D;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dev.d.ts","sourceRoot":"","sources":["../../src/commands/dev.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAIH,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"dev.d.ts","sourceRoot":"","sources":["../../src/commands/dev.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAIH,OAAO,KAAK,EACX,OAAO,EAGP,MAAM,kBAAkB,CAAC;AAoB1B,MAAM,WAAW,iBAAiB;IACjC,+DAA+D;IAC/D,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,kDAAkD;IAClD,OAAO,CAAC,EAAE,OAAO,CAAC;CAClB;AAED,wBAAsB,UAAU,CAAC,IAAI,GAAE,iBAAsB,GAAG,OAAO,CAAC,IAAI,CAAC,CA+S5E"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"doctor.d.ts","sourceRoot":"","sources":["../../src/commands/doctor.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;
|
|
1
|
+
{"version":3,"file":"doctor.d.ts","sourceRoot":"","sources":["../../src/commands/doctor.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAKhD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAGrD,MAAM,WAAW,oBAAoB;IACpC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,OAAO,CAAC;CAClB;AAQD,wBAAgB,aAAa,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,OAAO,EAAE,MAAM,GAAG;IACxE,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,QAAQ,EAAE,CAAC,GAAG,CAAC,CAAC;CAChB,CAoBA;AAED,wBAAsB,aAAa,CAAC,IAAI,GAAE,oBAAyB,GAAG,OAAO,CAAC,IAAI,CAAC,CA2ClF"}
|
|
@@ -20,6 +20,8 @@ export interface InitConfigOptions {
|
|
|
20
20
|
interactive?: boolean;
|
|
21
21
|
/** Active profile (passed by buildCli) — forwarded to the post-wizard doctor pass. */
|
|
22
22
|
profile?: Profile;
|
|
23
|
+
/** Override default output path (`<cwd>/cockpit.yaml`). */
|
|
24
|
+
output?: string;
|
|
23
25
|
}
|
|
24
26
|
export declare function buildTemplate(opts: {
|
|
25
27
|
withDocker: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"init-config.d.ts","sourceRoot":"","sources":["../../src/commands/init-config.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAIH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAIhD,MAAM,WAAW,iBAAiB;
|
|
1
|
+
{"version":3,"file":"init-config.d.ts","sourceRoot":"","sources":["../../src/commands/init-config.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAIH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAIhD,MAAM,WAAW,iBAAiB;IACjC,iEAAiE;IACjE,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,2DAA2D;IAC3D,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,mDAAmD;IACnD,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,6DAA6D;IAC7D,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,yEAAyE;IACzE,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,sFAAsF;IACtF,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,2DAA2D;IAC3D,MAAM,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,wBAAgB,aAAa,CAAC,IAAI,EAAE;IAAE,UAAU,EAAE,OAAO,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,GAAG,MAAM,CAoEpF;AAED,MAAM,WAAW,gBAAgB;IAChC,6BAA6B;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,gDAAgD;IAChD,SAAS,EAAE,OAAO,CAAC;CACnB;AAED,wBAAsB,iBAAiB,CACtC,IAAI,GAAE,iBAAsB,GAC1B,OAAO,CAAC,gBAAgB,GAAG,IAAI,CAAC,CA+DlC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `dev-cockpit link` — manage the project→config mapping in
|
|
3
|
+
* $XDG_DATA_HOME/dev-cockpit/manifest.json.
|
|
4
|
+
*
|
|
5
|
+
* Sub-commands:
|
|
6
|
+
* link <config-path> register a mapping for the current cwd
|
|
7
|
+
* link list show all registered mappings
|
|
8
|
+
* link remove unregister the current cwd
|
|
9
|
+
*
|
|
10
|
+
* Path canonicalisation (symlink-resolved) happens inside the manifest
|
|
11
|
+
* module — the same cwd reached via a symlinked alias hashes to the
|
|
12
|
+
* same key as its real path.
|
|
13
|
+
*/
|
|
14
|
+
export interface LinkAddOptions {
|
|
15
|
+
configPath: string;
|
|
16
|
+
}
|
|
17
|
+
export declare function linkAddCommand(opts: LinkAddOptions): void;
|
|
18
|
+
export declare function linkListCommand(): void;
|
|
19
|
+
export declare function linkRemoveCommand(): void;
|
|
20
|
+
//# sourceMappingURL=link.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"link.d.ts","sourceRoot":"","sources":["../../src/commands/link.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAYH,MAAM,WAAW,cAAc;IAC9B,UAAU,EAAE,MAAM,CAAC;CACnB;AAED,wBAAgB,cAAc,CAAC,IAAI,EAAE,cAAc,GAAG,IAAI,CAazD;AAED,wBAAgB,eAAe,IAAI,IAAI,CAYtC;AAED,wBAAgB,iBAAiB,IAAI,IAAI,CAUxC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mount.d.ts","sourceRoot":"","sources":["../../src/commands/mount.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAIH,OAAO,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"mount.d.ts","sourceRoot":"","sources":["../../src/commands/mount.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAIH,OAAO,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAuBvD,MAAM,WAAW,mBAAmB;IACnC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,2DAA2D;IAC3D,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,uEAAuE;IACvE,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,uEAAuE;IACvE,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;CACnB;AAED,wBAAgB,WAAW,CAC1B,YAAY,EAAE,SAAS,KAAK,EAAE,EAC9B,cAAc,EAAE,SAAS,KAAK,EAAE,GAC9B,KAAK,EAAE,CAKT;AAsGD,wBAAsB,YAAY,CAAC,IAAI,GAAE,mBAAwB,GAAG,OAAO,CAAC,IAAI,CAAC,CAqEhF;AAED,wBAAsB,kBAAkB,CAAC,IAAI,GAAE,mBAAwB,GAAG,OAAO,CAAC,IAAI,CAAC,CAkEtF;AAED,wBAAsB,iBAAiB,CAAC,IAAI,GAAE,mBAAwB,GAAG,OAAO,CAAC,IAAI,CAAC,CAsCrF"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Resolve the cockpit.yaml path + workspace root for a command invocation.
|
|
3
|
+
*
|
|
4
|
+
* Precedence (high → low):
|
|
5
|
+
* 1. --config CLI flag (explicit)
|
|
6
|
+
* 2. DEV_COCKPIT_CONFIG env var
|
|
7
|
+
* 3. <workspace>/cockpit.yaml
|
|
8
|
+
* 4. $XDG_DATA_HOME/dev-cockpit/manifest.json[workspace]
|
|
9
|
+
* 5. throw DiscoveryError
|
|
10
|
+
*
|
|
11
|
+
* `workspace` is canonical(cwd) unless a profile supplies its own
|
|
12
|
+
* discoverer (awc-cockpit's walks up looking for bedrock/ +
|
|
13
|
+
* docker/compose/). Paths inside the YAML are always workspace-relative,
|
|
14
|
+
* regardless of where the YAML file itself lives.
|
|
15
|
+
*/
|
|
16
|
+
export type DiscoverySource = 'cli' | 'env' | 'workspace' | 'manifest';
|
|
17
|
+
export interface DiscoveryResult {
|
|
18
|
+
configPath: string;
|
|
19
|
+
workspaceRoot: string;
|
|
20
|
+
source: DiscoverySource;
|
|
21
|
+
}
|
|
22
|
+
export interface DiscoverConfigOptions {
|
|
23
|
+
/** Working directory; defaults to process.cwd(). */
|
|
24
|
+
cwd?: string;
|
|
25
|
+
/** Value of the --config CLI flag, if passed. */
|
|
26
|
+
cliConfig?: string | undefined;
|
|
27
|
+
/** Optional profile.discoverer hook that yields { root } when it matches. */
|
|
28
|
+
workspaceDiscoverer?: (() => {
|
|
29
|
+
root: string;
|
|
30
|
+
} | null | undefined) | undefined;
|
|
31
|
+
/** Override of DEV_COCKPIT_CONFIG; injectable for tests. */
|
|
32
|
+
envConfig?: string | undefined;
|
|
33
|
+
}
|
|
34
|
+
export declare class DiscoveryError extends Error {
|
|
35
|
+
readonly workspaceRoot: string;
|
|
36
|
+
constructor(workspaceRoot: string);
|
|
37
|
+
}
|
|
38
|
+
export declare function discoverConfig(opts?: DiscoverConfigOptions): DiscoveryResult;
|
|
39
|
+
//# sourceMappingURL=config-discovery.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config-discovery.d.ts","sourceRoot":"","sources":["../../src/core/config-discovery.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAMH,MAAM,MAAM,eAAe,GAAG,KAAK,GAAG,KAAK,GAAG,WAAW,GAAG,UAAU,CAAC;AAEvE,MAAM,WAAW,eAAe;IAC/B,UAAU,EAAE,MAAM,CAAC;IACnB,aAAa,EAAE,MAAM,CAAC;IACtB,MAAM,EAAE,eAAe,CAAC;CACxB;AAED,MAAM,WAAW,qBAAqB;IACrC,oDAAoD;IACpD,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,iDAAiD;IACjD,SAAS,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC/B,6EAA6E;IAC7E,mBAAmB,CAAC,EAAE,CAAC,MAAM;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,GAAG,SAAS,CAAC,GAAG,SAAS,CAAC;IAC9E,4DAA4D;IAC5D,SAAS,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CAC/B;AAED,qBAAa,cAAe,SAAQ,KAAK;aACZ,aAAa,EAAE,MAAM;gBAArB,aAAa,EAAE,MAAM;CASjD;AAED,wBAAgB,cAAc,CAAC,IAAI,GAAE,qBAA0B,GAAG,eAAe,CAuChF"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Read/write the global project→config manifest at
|
|
3
|
+
* `$XDG_DATA_HOME/dev-cockpit/manifest.json`. Keys are canonical
|
|
4
|
+
* absolute paths to a workspace root; values are absolute paths to
|
|
5
|
+
* the cockpit.yaml that workspace should use.
|
|
6
|
+
*
|
|
7
|
+
* Used by core/config-discovery.ts as the last-resort lookup when
|
|
8
|
+
* the workspace doesn't carry its own cockpit.yaml at the root.
|
|
9
|
+
*/
|
|
10
|
+
declare const MANIFEST_VERSION: 1;
|
|
11
|
+
export interface Manifest {
|
|
12
|
+
version: typeof MANIFEST_VERSION;
|
|
13
|
+
projects: Record<string, string>;
|
|
14
|
+
}
|
|
15
|
+
/** Absolute path of `$XDG_DATA_HOME/dev-cockpit/manifest.json`. */
|
|
16
|
+
export declare function manifestPath(): string;
|
|
17
|
+
/**
|
|
18
|
+
* Canonicalise an absolute path — resolves symlinks if the path exists,
|
|
19
|
+
* falls back to `path.resolve()` otherwise. Ensures a symlinked workspace
|
|
20
|
+
* dir (`~/work`) and its real target (`/Users/me/code/work`) hash to the
|
|
21
|
+
* same manifest key.
|
|
22
|
+
*/
|
|
23
|
+
export declare function canonical(p: string): string;
|
|
24
|
+
/**
|
|
25
|
+
* Read the manifest. Returns `null` when the file is missing, unreadable,
|
|
26
|
+
* malformed JSON, or doesn't match the expected shape. Callers treat null
|
|
27
|
+
* as "no mapping registered" rather than an error — the user simply
|
|
28
|
+
* hasn't run `dev-cockpit link` yet.
|
|
29
|
+
*/
|
|
30
|
+
export declare function readManifest(): Manifest | null;
|
|
31
|
+
/** Look up a workspace's config path. Returns `null` when unmapped. */
|
|
32
|
+
export declare function lookupConfig(workspaceRoot: string): string | null;
|
|
33
|
+
/**
|
|
34
|
+
* Register a mapping. Both inputs are canonicalised first — the
|
|
35
|
+
* workspace key is resolved through symlinks so a `~/work` symlink and
|
|
36
|
+
* `/Users/me/code/work` real path resolve to the same entry.
|
|
37
|
+
*/
|
|
38
|
+
export declare function setMapping(workspaceRoot: string, configPath: string): void;
|
|
39
|
+
/** Remove a mapping. Returns `true` when an entry was deleted. */
|
|
40
|
+
export declare function removeMapping(workspaceRoot: string): boolean;
|
|
41
|
+
/** Sorted mapping list, for `dev-cockpit link list`. */
|
|
42
|
+
export declare function listMappings(): Array<{
|
|
43
|
+
workspace: string;
|
|
44
|
+
config: string;
|
|
45
|
+
}>;
|
|
46
|
+
export {};
|
|
47
|
+
//# sourceMappingURL=manifest.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"manifest.d.ts","sourceRoot":"","sources":["../../src/core/manifest.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAMH,QAAA,MAAM,gBAAgB,EAAG,CAAU,CAAC;AAEpC,MAAM,WAAW,QAAQ;IACvB,OAAO,EAAE,OAAO,gBAAgB,CAAC;IACjC,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAClC;AAED,mEAAmE;AACnE,wBAAgB,YAAY,IAAI,MAAM,CAKrC;AAED;;;;;GAKG;AACH,wBAAgB,SAAS,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAO3C;AAED;;;;;GAKG;AACH,wBAAgB,YAAY,IAAI,QAAQ,GAAG,IAAI,CAe9C;AAED,uEAAuE;AACvE,wBAAgB,YAAY,CAAC,aAAa,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAIjE;AAeD;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,aAAa,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,IAAI,CAI1E;AAED,kEAAkE;AAClE,wBAAgB,aAAa,CAAC,aAAa,EAAE,MAAM,GAAG,OAAO,CAQ5D;AAED,wDAAwD;AACxD,wBAAgB,YAAY,IAAI,KAAK,CAAC;IAAE,SAAS,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC,CAM3E"}
|