@habitat-ai/cli 0.5.14 → 0.6.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/README.md +62 -4
- package/dist/application-gZ8XAszE.js +80 -0
- package/dist/application.js +2 -18
- package/dist/cli-hhbbymEz.js +4738 -0
- package/dist/cli.js +2 -0
- package/dist/command-DkmTpQvc.js +74 -0
- package/dist/command.d.ts +36 -35
- package/dist/command.js +2 -45
- package/dist/generators/cli-command.js +263 -0
- package/dist/generators/cli-extension.js +192 -0
- package/dist/generators/init.js +20 -20
- package/dist/generators/preset.js +8 -7
- package/dist/generators/remove-hook.js +7 -4
- package/dist/generators/service.js +130 -139
- package/dist/habitat.app-Cl-58zQB.js +16615 -0
- package/dist/habitat.app.js +2 -0
- package/dist/host-BcptPYDL.js +293 -0
- package/dist/host.d.ts +57 -0
- package/dist/host.js +3 -0
- package/dist/index.js +8 -5
- package/dist/initialization-BWDg3bks.js +249 -0
- package/dist/migrations/0-5-7-repository-foundation.js +42 -38
- package/dist/nx-generators-DQDXOkMX.js +44 -0
- package/dist/nx-generators.js +2 -51
- package/dist/nx-plugin.d.ts +4 -1
- package/dist/nx-plugin.js +241 -15
- package/dist/oclif-CJS8CHjO.js +11 -0
- package/dist/oclif.js +3 -0
- package/dist/product-version-Bqc0L8lq.js +18 -0
- package/dist/publish-generator-tree-CgFdcykY.js +14 -0
- package/dist/repository-preset-DYxxe7p3.js +543 -0
- package/dist/verified-writes-Cne-zTxS.js +60 -0
- package/generators/cli-command/schema.json +20 -0
- package/generators/cli-extension/schema.json +20 -0
- package/generators/service/files/AGENTS.md.template +2 -2
- package/generators/service/files/habitat.toml.template +1 -1
- package/generators.json +10 -0
- package/oclif.manifest.json +1094 -27
- package/package.json +72 -8
- package/dist/application.d.ts +0 -14
- package/dist/commands/check.d.ts +0 -15
- package/dist/commands/check.js +0 -32
- package/dist/commands/hook.d.ts +0 -12
- package/dist/commands/hook.js +0 -25
- package/dist/commands/resolve.d.ts +0 -9
- package/dist/commands/resolve.js +0 -15
- package/dist/generators/init.d.ts +0 -3
- package/dist/generators/preset.d.ts +0 -4
- package/dist/generators/remove-hook.d.ts +0 -3
- package/dist/generators/service.d.ts +0 -16
- package/dist/index.d.ts +0 -1
- package/dist/lib/binding.d.ts +0 -10
- package/dist/lib/binding.js +0 -16
- package/dist/lib/output.d.ts +0 -9
- package/dist/lib/output.js +0 -22
- package/dist/migrations/0-5-7-repository-foundation.d.ts +0 -3
- package/dist/nx/initialization.d.ts +0 -62
- package/dist/nx/initialization.js +0 -265
- package/dist/nx/projection.d.ts +0 -29
- package/dist/nx/projection.js +0 -308
- package/dist/nx/repository-preset.d.ts +0 -22
- package/dist/nx/repository-preset.js +0 -595
- package/dist/nx-generators.d.ts +0 -42
- package/dist/product-version.d.ts +0 -2
- package/dist/product-version.js +0 -15
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@habitat-ai/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -43,6 +43,11 @@
|
|
|
43
43
|
"import": "./dist/command.js",
|
|
44
44
|
"default": "./dist/command.js"
|
|
45
45
|
},
|
|
46
|
+
"./host": {
|
|
47
|
+
"types": "./dist/host.d.ts",
|
|
48
|
+
"import": "./dist/host.js",
|
|
49
|
+
"default": "./dist/host.js"
|
|
50
|
+
},
|
|
46
51
|
"./nx-plugin": {
|
|
47
52
|
"types": "./dist/nx-plugin.d.ts",
|
|
48
53
|
"import": "./dist/nx-plugin.js",
|
|
@@ -52,40 +57,65 @@
|
|
|
52
57
|
},
|
|
53
58
|
"scripts": {
|
|
54
59
|
"habitat": "bun src/index.ts",
|
|
55
|
-
"build": "
|
|
60
|
+
"build": "tsdown",
|
|
56
61
|
"manifest": "NODE_ENV=production bun --bun oclif manifest",
|
|
57
62
|
"acceptance:oclif-installed-package": "vitest run --project habitat-cli-installed-package-acceptance",
|
|
58
63
|
"acceptance:oclif-native-plugins": "vitest run --project habitat-cli-native-plugins-acceptance",
|
|
64
|
+
"acceptance:oclif-native-runtime": "vitest run --project habitat-cli-native-runtime-acceptance",
|
|
65
|
+
"acceptance:oclif-native-telemetry": "HABITAT_NATIVE_AGENT_ACCEPTANCE=1 vitest run --project habitat-cli-installed-package-acceptance --testNamePattern \"adopts the packed CLI|connected agent-plugin native telemetry|real native agent-plugin lifecycle\"",
|
|
66
|
+
"acceptance:dev-native": "HABITAT_NATIVE_DEV_ACCEPTANCE=1 vitest run --project habitat-cli-installed-package-acceptance --testNamePattern \"adopts the packed CLI|installed developer\"",
|
|
67
|
+
"acceptance:generators-installed-package": "vitest run --project habitat-cli-installed-package-acceptance --testNamePattern \"adopts the packed CLI\"",
|
|
59
68
|
"typecheck": "tsc -p tsconfig.json --noEmit",
|
|
60
69
|
"check:test": "tsc -p test/tsconfig.json --noEmit",
|
|
61
70
|
"test": "vitest run --project habitat-cli"
|
|
62
71
|
},
|
|
63
72
|
"dependencies": {
|
|
64
|
-
"@
|
|
73
|
+
"@effect/platform-node": "4.0.0-beta.101",
|
|
74
|
+
"@getgrit/cli": "0.1.0-alpha.1743007075",
|
|
75
|
+
"@habitat-ai/sdk": "0.6.0",
|
|
65
76
|
"@nx/devkit": "23.1.1",
|
|
66
|
-
"@oclif/core": "
|
|
77
|
+
"@oclif/core": "4.13.3",
|
|
67
78
|
"@oclif/plugin-help": "^6.2.27",
|
|
68
79
|
"@oclif/plugin-plugins": "^5.4.84",
|
|
69
|
-
"
|
|
80
|
+
"@opentelemetry/api": "1.9.0",
|
|
81
|
+
"@orpc/contract": "2.0.0-beta.32",
|
|
82
|
+
"@orpc/experimental-effect": "2.0.0-beta.32",
|
|
83
|
+
"@orpc/server": "2.0.0-beta.32",
|
|
84
|
+
"effect": "4.0.0-beta.101",
|
|
85
|
+
"nx": "23.1.1",
|
|
86
|
+
"picomatch": "4.0.4",
|
|
87
|
+
"smol-toml": "1.7.0",
|
|
88
|
+
"typebox": "1.3.8",
|
|
89
|
+
"typescript": "5.9.3"
|
|
70
90
|
},
|
|
71
91
|
"devDependencies": {
|
|
72
92
|
"@types/node": "^24.13.3",
|
|
73
93
|
"bun-types": "1.3.14",
|
|
74
94
|
"oclif": "4.23.29",
|
|
75
|
-
"
|
|
95
|
+
"tsdown": "0.22.14",
|
|
76
96
|
"vitest": "^4.0.18"
|
|
77
97
|
},
|
|
78
98
|
"oclif": {
|
|
79
99
|
"bin": "habitat",
|
|
80
100
|
"dirname": "habitat",
|
|
81
|
-
"commands":
|
|
101
|
+
"commands": {
|
|
102
|
+
"strategy": "explicit",
|
|
103
|
+
"target": "./dist/oclif.js",
|
|
104
|
+
"identifier": "COMMANDS"
|
|
105
|
+
},
|
|
106
|
+
"hooks": {
|
|
107
|
+
"finally": {
|
|
108
|
+
"target": "./dist/oclif.js",
|
|
109
|
+
"identifier": "FINALLY_HOOK"
|
|
110
|
+
}
|
|
111
|
+
},
|
|
82
112
|
"topicSeparator": " ",
|
|
83
113
|
"plugins": [
|
|
84
114
|
"@oclif/plugin-help",
|
|
85
115
|
"@oclif/plugin-plugins"
|
|
86
116
|
],
|
|
87
117
|
"typescript": {
|
|
88
|
-
"commands": "./src/
|
|
118
|
+
"commands": "./src/oclif.ts"
|
|
89
119
|
}
|
|
90
120
|
},
|
|
91
121
|
"nx": {
|
|
@@ -107,6 +137,11 @@
|
|
|
107
137
|
"manifest"
|
|
108
138
|
]
|
|
109
139
|
},
|
|
140
|
+
"check:test": {
|
|
141
|
+
"dependsOn": [
|
|
142
|
+
"build"
|
|
143
|
+
]
|
|
144
|
+
},
|
|
110
145
|
"acceptance:oclif-installed-package": {
|
|
111
146
|
"cache": false,
|
|
112
147
|
"dependsOn": [
|
|
@@ -120,6 +155,35 @@
|
|
|
120
155
|
"manifest"
|
|
121
156
|
],
|
|
122
157
|
"outputs": []
|
|
158
|
+
},
|
|
159
|
+
"acceptance:oclif-native-runtime": {
|
|
160
|
+
"cache": false,
|
|
161
|
+
"dependsOn": [
|
|
162
|
+
"build",
|
|
163
|
+
"manifest"
|
|
164
|
+
],
|
|
165
|
+
"outputs": []
|
|
166
|
+
},
|
|
167
|
+
"acceptance:oclif-native-telemetry": {
|
|
168
|
+
"cache": false,
|
|
169
|
+
"dependsOn": [
|
|
170
|
+
"manifest"
|
|
171
|
+
],
|
|
172
|
+
"outputs": []
|
|
173
|
+
},
|
|
174
|
+
"acceptance:dev-native": {
|
|
175
|
+
"cache": false,
|
|
176
|
+
"dependsOn": [
|
|
177
|
+
"manifest"
|
|
178
|
+
],
|
|
179
|
+
"outputs": []
|
|
180
|
+
},
|
|
181
|
+
"acceptance:generators-installed-package": {
|
|
182
|
+
"cache": false,
|
|
183
|
+
"dependsOn": [
|
|
184
|
+
"manifest"
|
|
185
|
+
],
|
|
186
|
+
"outputs": []
|
|
123
187
|
}
|
|
124
188
|
}
|
|
125
189
|
},
|
package/dist/application.d.ts
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
/** Inputs fixed by one Habitat process activation. */
|
|
2
|
-
export type ExecuteHabitatOptions = Readonly<{
|
|
3
|
-
appRoot: string;
|
|
4
|
-
workspaceRoot: string;
|
|
5
|
-
args?: string[];
|
|
6
|
-
development?: boolean;
|
|
7
|
-
}>;
|
|
8
|
-
/**
|
|
9
|
-
* Runs one native Oclif invocation over the app-selected Habitat client.
|
|
10
|
-
*
|
|
11
|
-
* Oclif owns command discovery and dispatch; this boundary supplies only the
|
|
12
|
-
* ready workspace client required by the Habitat commands.
|
|
13
|
-
*/
|
|
14
|
-
export declare function executeHabitat({ appRoot, workspaceRoot, args, development, }: ExecuteHabitatOptions): Promise<unknown>;
|
package/dist/commands/check.d.ts
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import type { HabitatClient } from "@habitat-ai/sdk";
|
|
2
|
-
import { Command } from "@oclif/core";
|
|
3
|
-
type CheckResult = Awaited<ReturnType<HabitatClient["catalog"]["check"]>>;
|
|
4
|
-
/** Projects one selected Habitat catalog check into Oclif. */
|
|
5
|
-
export default class Check extends Command {
|
|
6
|
-
static description: string;
|
|
7
|
-
static flags: {
|
|
8
|
-
readonly instance: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
9
|
-
readonly owner: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
10
|
-
readonly rule: import("@oclif/core/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
11
|
-
readonly runner: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
12
|
-
};
|
|
13
|
-
run(): Promise<CheckResult>;
|
|
14
|
-
}
|
|
15
|
-
export {};
|
package/dist/commands/check.js
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { Command, Flags } from "@oclif/core";
|
|
2
|
-
import { habitatClientFrom } from "../lib/binding.js";
|
|
3
|
-
import { writeJsonResult } from "../lib/output.js";
|
|
4
|
-
/** Projects one selected Habitat catalog check into Oclif. */
|
|
5
|
-
export default class Check extends Command {
|
|
6
|
-
static description = "Check resolved Habitat applications";
|
|
7
|
-
static flags = {
|
|
8
|
-
instance: Flags.string({ description: "Exact Habitat instance identity" }),
|
|
9
|
-
owner: Flags.string({ description: "Repository project whose applications enter the check" }),
|
|
10
|
-
rule: Flags.string({
|
|
11
|
-
description: "Habitat rule identity; repeat to select a rule set",
|
|
12
|
-
multiple: true,
|
|
13
|
-
}),
|
|
14
|
-
runner: Flags.string({ description: "Mechanical runner identity" }),
|
|
15
|
-
};
|
|
16
|
-
async run() {
|
|
17
|
-
const { flags } = await this.parse(Check);
|
|
18
|
-
const rules = Array.isArray(flags.rule) ? flags.rule : flags.rule ? [flags.rule] : [];
|
|
19
|
-
const selectors = {
|
|
20
|
-
...(flags.instance !== undefined ? { instance: flags.instance } : {}),
|
|
21
|
-
...(flags.owner !== undefined ? { owner: flags.owner } : {}),
|
|
22
|
-
...(rules.length === 1 ? { rule: rules[0] } : {}),
|
|
23
|
-
...(rules.length > 1 ? { rules } : {}),
|
|
24
|
-
...(flags.runner !== undefined ? { runner: flags.runner } : {}),
|
|
25
|
-
};
|
|
26
|
-
const result = await habitatClientFrom(this.config).catalog.check(Object.keys(selectors).length === 0 ? {} : { selectors });
|
|
27
|
-
await writeJsonResult(result);
|
|
28
|
-
if (result._tag !== "Completed" || !result.ok)
|
|
29
|
-
this.exit(1);
|
|
30
|
-
return result;
|
|
31
|
-
}
|
|
32
|
-
}
|
package/dist/commands/hook.d.ts
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import type { HabitatClient } from "@habitat-ai/sdk";
|
|
2
|
-
import { Command } from "@oclif/core";
|
|
3
|
-
type HookResult = Awaited<ReturnType<HabitatClient["catalog"]["check"]>>;
|
|
4
|
-
/** Runs one bounded Habitat operation for a repository-owned local hook. */
|
|
5
|
-
export default class Hook extends Command {
|
|
6
|
-
static description: string;
|
|
7
|
-
static args: {
|
|
8
|
-
readonly name: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
|
|
9
|
-
};
|
|
10
|
-
run(): Promise<HookResult>;
|
|
11
|
-
}
|
|
12
|
-
export {};
|
package/dist/commands/hook.js
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { Args, Command } from "@oclif/core";
|
|
2
|
-
import { habitatClientFrom } from "../lib/binding.js";
|
|
3
|
-
import { writeJsonResult } from "../lib/output.js";
|
|
4
|
-
/** Runs one bounded Habitat operation for a repository-owned local hook. */
|
|
5
|
-
export default class Hook extends Command {
|
|
6
|
-
static description = "Run a Habitat local-hook entrypoint";
|
|
7
|
-
static args = {
|
|
8
|
-
name: Args.string({
|
|
9
|
-
required: true,
|
|
10
|
-
options: ["agent-stop"],
|
|
11
|
-
description: "Named Habitat hook operation",
|
|
12
|
-
}),
|
|
13
|
-
};
|
|
14
|
-
async run() {
|
|
15
|
-
await this.parse(Hook);
|
|
16
|
-
const result = await habitatClientFrom(this.config).catalog.check({
|
|
17
|
-
selectors: { runner: "habitat" },
|
|
18
|
-
});
|
|
19
|
-
if (result._tag !== "Completed" || !result.ok) {
|
|
20
|
-
await writeJsonResult(result);
|
|
21
|
-
this.exit(1);
|
|
22
|
-
}
|
|
23
|
-
return result;
|
|
24
|
-
}
|
|
25
|
-
}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import type { HabitatClient } from "@habitat-ai/sdk";
|
|
2
|
-
import { Command } from "@oclif/core";
|
|
3
|
-
type ResolveResult = Awaited<ReturnType<HabitatClient["catalog"]["resolve"]>>;
|
|
4
|
-
/** Projects current-workspace Habitat catalog resolution into Oclif. */
|
|
5
|
-
export default class Resolve extends Command {
|
|
6
|
-
static description: string;
|
|
7
|
-
run(): Promise<ResolveResult>;
|
|
8
|
-
}
|
|
9
|
-
export {};
|
package/dist/commands/resolve.js
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { Command } from "@oclif/core";
|
|
2
|
-
import { habitatClientFrom } from "../lib/binding.js";
|
|
3
|
-
import { writeJsonResult } from "../lib/output.js";
|
|
4
|
-
/** Projects current-workspace Habitat catalog resolution into Oclif. */
|
|
5
|
-
export default class Resolve extends Command {
|
|
6
|
-
static description = "Resolve the current Habitat authority catalog";
|
|
7
|
-
async run() {
|
|
8
|
-
await this.parse(Resolve);
|
|
9
|
-
const result = await habitatClientFrom(this.config).catalog.resolve({});
|
|
10
|
-
await writeJsonResult(result);
|
|
11
|
-
if (result._tag === "Rejected")
|
|
12
|
-
this.exit(1);
|
|
13
|
-
return result;
|
|
14
|
-
}
|
|
15
|
-
}
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import { type GeneratorCallback, type Tree } from "@nx/devkit";
|
|
2
|
-
import { type HabitatRepositoryPresetOptions } from "../nx/repository-preset.js";
|
|
3
|
-
/** Creates Habitat's portable Bun/Nx repository spine before Git initialization. */
|
|
4
|
-
export default function createHabitatRepository(tree: Tree, options: HabitatRepositoryPresetOptions): GeneratorCallback | undefined;
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { type GeneratorCallback, type Tree } from "@nx/devkit";
|
|
2
|
-
/** Exact non-SDK dependency pins emitted into every constructed service package. */
|
|
3
|
-
export declare const SERVICE_GENERATOR_DEPENDENCY_VERSIONS: {
|
|
4
|
-
readonly "@orpc/contract": "2.0.0-beta.23";
|
|
5
|
-
readonly "@orpc/server": "2.0.0-beta.23";
|
|
6
|
-
readonly typebox: "1.3.8";
|
|
7
|
-
};
|
|
8
|
-
/** Options for constructing one closed Habitat service package. */
|
|
9
|
-
export interface ServiceGeneratorOptions {
|
|
10
|
-
readonly name: string;
|
|
11
|
-
readonly directory: string;
|
|
12
|
-
readonly module: string;
|
|
13
|
-
readonly operation: string;
|
|
14
|
-
}
|
|
15
|
-
/** Constructs a private service package through Nx and schedules Bun dependency installation. */
|
|
16
|
-
export default function createService(tree: Tree, options: ServiceGeneratorOptions): Promise<GeneratorCallback>;
|
package/dist/index.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/dist/lib/binding.d.ts
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import type { HabitatClient } from "@habitat-ai/sdk";
|
|
2
|
-
import { type Config } from "@oclif/core";
|
|
3
|
-
/** Oclif load options carrying the ready Habitat client selected by the app. */
|
|
4
|
-
export type HabitatOclifLoadOptions = Config["options"] & {
|
|
5
|
-
readonly habitatClient: HabitatClient;
|
|
6
|
-
};
|
|
7
|
-
/** Adds the app-owned Habitat client to one native Oclif configuration. */
|
|
8
|
-
export declare function bindHabitatClient(options: Config["options"], client: HabitatClient): HabitatOclifLoadOptions;
|
|
9
|
-
/** Reads the ready Habitat client from the current native Oclif configuration. */
|
|
10
|
-
export declare function habitatClientFrom(config: Config): HabitatClient;
|
package/dist/lib/binding.js
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { Errors } from "@oclif/core";
|
|
2
|
-
const HABITAT_CLIENT = "habitatClient";
|
|
3
|
-
/** Adds the app-owned Habitat client to one native Oclif configuration. */
|
|
4
|
-
export function bindHabitatClient(options, client) {
|
|
5
|
-
return Object.freeze({ ...options, [HABITAT_CLIENT]: client });
|
|
6
|
-
}
|
|
7
|
-
/** Reads the ready Habitat client from the current native Oclif configuration. */
|
|
8
|
-
export function habitatClientFrom(config) {
|
|
9
|
-
if (!hasHabitatClient(config.options)) {
|
|
10
|
-
throw new Errors.CLIError("The Habitat app did not supply its service binding.");
|
|
11
|
-
}
|
|
12
|
-
return config.options.habitatClient;
|
|
13
|
-
}
|
|
14
|
-
function hasHabitatClient(options) {
|
|
15
|
-
return HABITAT_CLIENT in options && options.habitatClient !== undefined;
|
|
16
|
-
}
|
package/dist/lib/output.d.ts
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Writes one complete Habitat command result as JSON before the command returns.
|
|
3
|
-
*
|
|
4
|
-
* Awaiting the stream callback prevents Bun from ending the process while a
|
|
5
|
-
* large stdout write is still buffered at the Oclif process boundary. EPIPE
|
|
6
|
-
* remains successful because it means the downstream pipe deliberately
|
|
7
|
-
* stopped reading, matching Oclif's stdout behavior.
|
|
8
|
-
*/
|
|
9
|
-
export declare function writeJsonResult(result: unknown): Promise<void>;
|
package/dist/lib/output.js
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Writes one complete Habitat command result as JSON before the command returns.
|
|
3
|
-
*
|
|
4
|
-
* Awaiting the stream callback prevents Bun from ending the process while a
|
|
5
|
-
* large stdout write is still buffered at the Oclif process boundary. EPIPE
|
|
6
|
-
* remains successful because it means the downstream pipe deliberately
|
|
7
|
-
* stopped reading, matching Oclif's stdout behavior.
|
|
8
|
-
*/
|
|
9
|
-
export function writeJsonResult(result) {
|
|
10
|
-
return new Promise((resolve, reject) => {
|
|
11
|
-
process.stdout.write(`${JSON.stringify(result, null, 2)}\n`, (error) => {
|
|
12
|
-
if (error && !isBrokenPipe(error)) {
|
|
13
|
-
reject(error);
|
|
14
|
-
return;
|
|
15
|
-
}
|
|
16
|
-
resolve();
|
|
17
|
-
});
|
|
18
|
-
});
|
|
19
|
-
}
|
|
20
|
-
function isBrokenPipe(error) {
|
|
21
|
-
return "code" in error && error.code === "EPIPE";
|
|
22
|
-
}
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
import { type NxJsonConfiguration, type PluginConfiguration, type Tree } from "@nx/devkit";
|
|
2
|
-
import { type Static, Type } from "typebox";
|
|
3
|
-
declare const HookGroupSchema: Type.TObject<{
|
|
4
|
-
_habitat: Type.TOptional<Type.TObject<{
|
|
5
|
-
identity: Type.TString;
|
|
6
|
-
revision: Type.TInteger;
|
|
7
|
-
}>>;
|
|
8
|
-
hooks: Type.TArray<Type.TUnknown>;
|
|
9
|
-
}>;
|
|
10
|
-
declare const HabitatOwnedHookGroupSchema: Type.TObject<{
|
|
11
|
-
_habitat: Type.TObject<{
|
|
12
|
-
identity: Type.TString;
|
|
13
|
-
revision: Type.TInteger;
|
|
14
|
-
}>;
|
|
15
|
-
hooks: Type.TArray<Type.TObject<{
|
|
16
|
-
type: Type.TLiteral<"command">;
|
|
17
|
-
command: Type.TString;
|
|
18
|
-
statusMessage: Type.TString;
|
|
19
|
-
timeout: Type.TInteger;
|
|
20
|
-
}>>;
|
|
21
|
-
}>;
|
|
22
|
-
type HookGroup = Static<typeof HookGroupSchema>;
|
|
23
|
-
type HabitatOwnedHookGroup = Static<typeof HabitatOwnedHookGroupSchema>;
|
|
24
|
-
type PlannedValue<T> = Readonly<{
|
|
25
|
-
changed: boolean;
|
|
26
|
-
value: T;
|
|
27
|
-
}>;
|
|
28
|
-
/** App-owned identities and exact predecessor states consumed by native Nx initialization. */
|
|
29
|
-
export type HabitatConsumerBinding = Readonly<{
|
|
30
|
-
defaultCheckScript: string;
|
|
31
|
-
gitHook: Readonly<{
|
|
32
|
-
contents: string;
|
|
33
|
-
path: string;
|
|
34
|
-
}>;
|
|
35
|
-
gritPackage: string;
|
|
36
|
-
hook: HabitatOwnedHookGroup;
|
|
37
|
-
husky: Readonly<{
|
|
38
|
-
package: string;
|
|
39
|
-
prepare: string;
|
|
40
|
-
predecessorPrepareScripts: readonly string[];
|
|
41
|
-
version: string;
|
|
42
|
-
}>;
|
|
43
|
-
nxPlugin: string;
|
|
44
|
-
predecessorHooks: readonly HookGroup[];
|
|
45
|
-
predecessorNxPlugins: readonly PluginConfiguration[];
|
|
46
|
-
}>;
|
|
47
|
-
/** Reports whether dependency installation must precede local Husky activation. */
|
|
48
|
-
export type HabitatInitializationResult = Readonly<{
|
|
49
|
-
packageChanged: boolean;
|
|
50
|
-
}>;
|
|
51
|
-
/**
|
|
52
|
-
* Converges one Nx consumer on Habitat's app-owned Nx, Codex, package, and Git-hook state.
|
|
53
|
-
*
|
|
54
|
-
* Every admission and compatibility decision completes before the first Tree
|
|
55
|
-
* write, so an incompatible consumer remains byte-for-byte unchanged.
|
|
56
|
-
*/
|
|
57
|
-
export declare function initializeHabitatConsumer(tree: Tree, binding: HabitatConsumerBinding): HabitatInitializationResult;
|
|
58
|
-
/** Removes only Habitat's named hook group while preserving installed Nx integration. */
|
|
59
|
-
export declare function removeHabitatHook(tree: Tree, binding: HabitatConsumerBinding): void;
|
|
60
|
-
/** Plans the one package-owned Nx plugin registration without mutating a Tree. */
|
|
61
|
-
export declare function planHabitatNxRegistration(nxJson: NxJsonConfiguration, binding: HabitatConsumerBinding): PlannedValue<NxJsonConfiguration>;
|
|
62
|
-
export {};
|