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.
@@ -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
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dev-cockpit",
3
- "version": "0.2.1",
3
+ "version": "0.2.2",
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": {