dev-cockpit 0.2.1 → 0.2.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.
@@ -0,0 +1,65 @@
1
+ import { createRequire as __createRequireDC } from 'node:module';
2
+ const require = __createRequireDC(import.meta.url);
3
+
4
+ import {
5
+ canonical,
6
+ listMappings,
7
+ manifestPath,
8
+ removeMapping,
9
+ setMapping
10
+ } from "./chunk-C4GFJDMG.js";
11
+ import "./chunk-6XGHLLYT.js";
12
+
13
+ // src/commands/link.ts
14
+ import fs from "node:fs";
15
+ import path from "node:path";
16
+ function linkAddCommand(opts) {
17
+ const cwd = process.cwd();
18
+ const absConfig = path.resolve(cwd, opts.configPath);
19
+ if (!fs.existsSync(absConfig)) {
20
+ process.stderr.write(
21
+ `dev-cockpit link: ${absConfig} doesn't exist. Create the config file first or pass a valid path.
22
+ `
23
+ );
24
+ process.exit(1);
25
+ }
26
+ setMapping(cwd, absConfig);
27
+ process.stdout.write(
28
+ `dev-cockpit link: ${canonical(cwd)} \u2192 ${canonical(absConfig)}
29
+ `
30
+ );
31
+ }
32
+ function linkListCommand() {
33
+ const entries = listMappings();
34
+ if (entries.length === 0) {
35
+ process.stdout.write(
36
+ `dev-cockpit link: no mappings registered (manifest at ${manifestPath()}).
37
+ `
38
+ );
39
+ return;
40
+ }
41
+ const longest = Math.max(...entries.map((e) => e.workspace.length));
42
+ for (const { workspace, config } of entries) {
43
+ process.stdout.write(`${workspace.padEnd(longest)} \u2192 ${config}
44
+ `);
45
+ }
46
+ }
47
+ function linkRemoveCommand() {
48
+ const cwd = process.cwd();
49
+ const removed = removeMapping(cwd);
50
+ if (removed) {
51
+ process.stdout.write(`dev-cockpit link: removed mapping for ${canonical(cwd)}
52
+ `);
53
+ } else {
54
+ process.stdout.write(
55
+ `dev-cockpit link: no mapping for ${canonical(cwd)} (nothing to remove)
56
+ `
57
+ );
58
+ }
59
+ }
60
+ export {
61
+ linkAddCommand,
62
+ linkListCommand,
63
+ linkRemoveCommand
64
+ };
65
+ //# sourceMappingURL=link-HXNII7EU.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../src/commands/link.ts"],
4
+ "sourcesContent": ["/**\n * `dev-cockpit link` \u2014 manage the project\u2192config mapping in\n * $XDG_DATA_HOME/dev-cockpit/manifest.json.\n *\n * Sub-commands:\n * link <config-path> register a mapping for the current cwd\n * link list show all registered mappings\n * link remove unregister the current cwd\n *\n * Path canonicalisation (symlink-resolved) happens inside the manifest\n * module \u2014 the same cwd reached via a symlinked alias hashes to the\n * same key as its real path.\n */\n\nimport fs from 'node:fs';\nimport path from 'node:path';\nimport {\n\tcanonical,\n\tlistMappings,\n\tmanifestPath,\n\tremoveMapping,\n\tsetMapping,\n} from '../core/manifest.js';\n\nexport interface LinkAddOptions {\n\tconfigPath: string;\n}\n\nexport function linkAddCommand(opts: LinkAddOptions): void {\n\tconst cwd = process.cwd();\n\tconst absConfig = path.resolve(cwd, opts.configPath);\n\tif (!fs.existsSync(absConfig)) {\n\t\tprocess.stderr.write(\n\t\t\t`dev-cockpit link: ${absConfig} doesn't exist. Create the config file first or pass a valid path.\\n`,\n\t\t);\n\t\tprocess.exit(1);\n\t}\n\tsetMapping(cwd, absConfig);\n\tprocess.stdout.write(\n\t\t`dev-cockpit link: ${canonical(cwd)} \u2192 ${canonical(absConfig)}\\n`,\n\t);\n}\n\nexport function linkListCommand(): void {\n\tconst entries = listMappings();\n\tif (entries.length === 0) {\n\t\tprocess.stdout.write(\n\t\t\t`dev-cockpit link: no mappings registered (manifest at ${manifestPath()}).\\n`,\n\t\t);\n\t\treturn;\n\t}\n\tconst longest = Math.max(...entries.map((e) => e.workspace.length));\n\tfor (const { workspace, config } of entries) {\n\t\tprocess.stdout.write(`${workspace.padEnd(longest)} \u2192 ${config}\\n`);\n\t}\n}\n\nexport function linkRemoveCommand(): void {\n\tconst cwd = process.cwd();\n\tconst removed = removeMapping(cwd);\n\tif (removed) {\n\t\tprocess.stdout.write(`dev-cockpit link: removed mapping for ${canonical(cwd)}\\n`);\n\t} else {\n\t\tprocess.stdout.write(\n\t\t\t`dev-cockpit link: no mapping for ${canonical(cwd)} (nothing to remove)\\n`,\n\t\t);\n\t}\n}"],
5
+ "mappings": ";;;;;;;;;;;;;AAcA,OAAO,QAAQ;AACf,OAAO,UAAU;AAaV,SAAS,eAAe,MAA4B;AAC1D,QAAM,MAAM,QAAQ,IAAI;AACxB,QAAM,YAAY,KAAK,QAAQ,KAAK,KAAK,UAAU;AACnD,MAAI,CAAC,GAAG,WAAW,SAAS,GAAG;AAC9B,YAAQ,OAAO;AAAA,MACd,qBAAqB,SAAS;AAAA;AAAA,IAC/B;AACA,YAAQ,KAAK,CAAC;AAAA,EACf;AACA,aAAW,KAAK,SAAS;AACzB,UAAQ,OAAO;AAAA,IACd,qBAAqB,UAAU,GAAG,CAAC,WAAM,UAAU,SAAS,CAAC;AAAA;AAAA,EAC9D;AACD;AAEO,SAAS,kBAAwB;AACvC,QAAM,UAAU,aAAa;AAC7B,MAAI,QAAQ,WAAW,GAAG;AACzB,YAAQ,OAAO;AAAA,MACd,yDAAyD,aAAa,CAAC;AAAA;AAAA,IACxE;AACA;AAAA,EACD;AACA,QAAM,UAAU,KAAK,IAAI,GAAG,QAAQ,IAAI,CAAC,MAAM,EAAE,UAAU,MAAM,CAAC;AAClE,aAAW,EAAE,WAAW,OAAO,KAAK,SAAS;AAC5C,YAAQ,OAAO,MAAM,GAAG,UAAU,OAAO,OAAO,CAAC,aAAQ,MAAM;AAAA,CAAI;AAAA,EACpE;AACD;AAEO,SAAS,oBAA0B;AACzC,QAAM,MAAM,QAAQ,IAAI;AACxB,QAAM,UAAU,cAAc,GAAG;AACjC,MAAI,SAAS;AACZ,YAAQ,OAAO,MAAM,yCAAyC,UAAU,GAAG,CAAC;AAAA,CAAI;AAAA,EACjF,OAAO;AACN,YAAQ,OAAO;AAAA,MACd,oCAAoC,UAAU,GAAG,CAAC;AAAA;AAAA,IACnD;AAAA,EACD;AACD;",
6
+ "names": []
7
+ }
@@ -0,0 +1,26 @@
1
+ /**
2
+ * Resolve where the docker-compose overlay file should be written for a
3
+ * workspace.
4
+ *
5
+ * Default (no `mount.overlayPath` in cockpit.yaml):
6
+ * <stateDir>/dev-mount-overlay.yml
7
+ * — sibling to `mount.manifest.json`. Keeps the wrapper repo clean of
8
+ * per-developer state; aligns the overlay's lifecycle with the
9
+ * manifest's.
10
+ *
11
+ * Override (cockpit.yaml `mount.overlayPath` is set):
12
+ * - Workspace-relative paths resolve against `workspaceRoot`.
13
+ * - Absolute paths are honoured verbatim.
14
+ *
15
+ * Pure: no I/O. Tested in isolation.
16
+ */
17
+ export interface ResolveOverlayPathOptions {
18
+ /** Cockpit state dir for this workspace. */
19
+ stateDir: string;
20
+ /** Workspace root, used to resolve relative `configOverride`. */
21
+ workspaceRoot: string;
22
+ /** Optional `mount.overlayPath` value from cockpit.yaml. */
23
+ configOverride?: string | undefined;
24
+ }
25
+ export declare function resolveOverlayPath(opts: ResolveOverlayPathOptions): string;
26
+ //# sourceMappingURL=overlay-path.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"overlay-path.d.ts","sourceRoot":"","sources":["../../src/mount/overlay-path.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAIH,MAAM,WAAW,yBAAyB;IACxC,4CAA4C;IAC5C,QAAQ,EAAE,MAAM,CAAC;IACjB,iEAAiE;IACjE,aAAa,EAAE,MAAM,CAAC;IACtB,4DAA4D;IAC5D,cAAc,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CACrC;AAED,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,yBAAyB,GAAG,MAAM,CAM1E"}
@@ -14,7 +14,7 @@ A `cockpit.yaml` lives at the root of your project. The cockpit reads it on star
14
14
  | `highlights` | array | no | Regex patterns applied to all output streams (process + docker). Each can carry an explicit `severity:` (else inferred). |
15
15
  | `health` | array | no | Health check declarations — see `health:` below. |
16
16
  | `actions` | array | no | Named, optionally key-bound shell commands surfaced via the `:` palette and the Targets pane. |
17
- | `mount` | object | no | `overlayPath`, `manifestFile` overrides. Defaults: `docker-compose.dev-cockpit.yml`, `mount.manifest.json`. |
17
+ | `mount` | object | no | `overlayPath`, `manifestFile` overrides. Defaults: `<stateDir>/dev-mount-overlay.yml` (sibling to the manifest, keeps the wrapper repo clean), `mount.manifest.json`. |
18
18
  | `mounts` | array | no | Explicit `{hostPath, containerPath, meta?}` entries for `dev-cockpit mount`. |
19
19
  | `help` | object | no | Extra `sources[]` + `defaultPage`. |
20
20
  | `notifications` | object | no | `enabled`, `onTransitionTo[]`, `exclude[]`. |
@@ -84,8 +84,9 @@ health:
84
84
  ## `mount:` + `mounts:`
85
85
 
86
86
  ```yaml
87
- mount: # path overrides
88
- overlayPath: docker-compose.dev-cockpit.yml # workspace-relative
87
+ mount: # path overrides — omit for defaults
88
+ # overlayPath: docker-compose.dev-cockpit.yml # default: <stateDir>/dev-mount-overlay.yml
89
+ # set to keep the overlay in-repo (workspace-relative or absolute)
89
90
  manifestFile: mount.manifest.json # basename within stateDir
90
91
 
91
92
  mounts: # explicit candidates
package/docs/mount.md CHANGED
@@ -26,22 +26,22 @@ dev-cockpit mount status # active mounts with branch / dirty / broken-sy
26
26
  dev-cockpit mount clear # remove overlay + manifest + symlinks
27
27
  ```
28
28
 
29
- Apply the generated overlay alongside your existing compose file:
29
+ Apply the generated overlay alongside your existing compose file (the path is printed by `dev-cockpit mount` — copy it from there):
30
30
 
31
31
  ```sh
32
- docker compose -f docker-compose.yml -f docker-compose.dev-cockpit.yml up -d
32
+ docker compose -f docker-compose.yml -f <stateDir>/dev-mount-overlay.yml up -d
33
33
  ```
34
34
 
35
35
  ## What gets written
36
36
 
37
37
  | File | Default path | Configurable via |
38
38
  |---|---|---|
39
- | Compose overlay | `<workspace>/docker-compose.dev-cockpit.yml` | `config.mount.overlayPath` |
39
+ | Compose overlay | `<stateDir>/dev-mount-overlay.yml` | `config.mount.overlayPath` |
40
40
  | Manifest | `<stateDir>/mount.manifest.json` | `config.mount.manifestFile` |
41
41
 
42
- `<stateDir>` lives under `$XDG_STATE_HOME/<appName>/<workspace-hash>/`. The manifest tracks what was applied and when, and is the source of truth for `status` and `clear`.
42
+ `<stateDir>` lives under `$XDG_STATE_HOME/<appName>/<workspace-hash>/`. Both files share that location, so anything cockpit knows about *this workspace's mounts* sits in one dir — clean wrapper repo, no per-developer artefacts to gitignore.
43
43
 
44
- Override the paths when the wrapper has its own conventions:
44
+ Override the overlay path when the wrapper has its own conventions (workspace-relative or absolute):
45
45
 
46
46
  ```yaml
47
47
  mount:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dev-cockpit",
3
- "version": "0.2.1",
3
+ "version": "0.2.3",
4
4
  "description": "A reusable, domain-neutral terminal UI dev cockpit — tabbed pane shell, watcher streaming, optional Docker log tail with highlights, health framework with one-keystroke remediations, transition-only OS notifications, live-markdown Help. Profiles extend it with project-specific commands, repos, and health checks.",
5
5
  "license": "MIT",
6
6
  "repository": {