@habitat-ai/cli 0.5.15 → 0.7.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 +100 -4
- package/dist/application-Idvdhc9h.js +80 -0
- package/dist/application.js +2 -18
- package/dist/cli-DxjKzwlV.js +4757 -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-CgdXa2f2.js +16617 -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 +247 -15
- package/dist/oclif-DBwcAyVK.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 +5 -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 -596
- package/dist/nx-generators.d.ts +0 -42
- package/dist/product-version.d.ts +0 -2
- package/dist/product-version.js +0 -15
package/README.md
CHANGED
|
@@ -15,6 +15,57 @@ habitat plugins --help
|
|
|
15
15
|
`@oclif/plugin-plugins` owns listing, installation, linking, inspection,
|
|
16
16
|
updates, reset, uninstallation, aliases, and its native per-user state.
|
|
17
17
|
|
|
18
|
+
## Curated Agent Plugins
|
|
19
|
+
|
|
20
|
+
`habitat agent plugins check|package|status|sync|test|vendors update` projects
|
|
21
|
+
the platform lifecycle service. Use each command's native `--help` for its
|
|
22
|
+
closed request shape. Content repositories, immutable Git identities, provider
|
|
23
|
+
homes and package outputs are explicit inputs, not executable plugin discovery.
|
|
24
|
+
|
|
25
|
+
Current-main consumes `.habitat/agent-plugin-lifecycle/channels/current-main.json`
|
|
26
|
+
and the selected commit's `.habitat/release-input.json`. Older `.rawr` paths are
|
|
27
|
+
not fallback aliases. Publishing these records in Marketplace is a separate
|
|
28
|
+
repository-owner adoption action; installing the CLI does not migrate them.
|
|
29
|
+
|
|
30
|
+
Technical telemetry defaults to disabled. `HABITAT_TELEMETRY` accepts explicit
|
|
31
|
+
JSON matching the SDK's `OpenTelemetryNodeConfigSchema`, excluding
|
|
32
|
+
`processIdentity`, which the app supplies. Enabled configuration specifies all
|
|
33
|
+
three OTLP HTTP signal URLs, headers, timeouts and export settings. It is read
|
|
34
|
+
only after native command admission; help and parser refusals acquire nothing.
|
|
35
|
+
Telemetry configures transport, not a HyperDX/ClickHouse backend or product
|
|
36
|
+
analytics pipeline.
|
|
37
|
+
|
|
38
|
+
## Development Operations
|
|
39
|
+
|
|
40
|
+
The four generic operations use native Git and Graphite through the selected
|
|
41
|
+
Effect Platform Node resources:
|
|
42
|
+
|
|
43
|
+
```sh
|
|
44
|
+
habitat dev repo sync-upstream
|
|
45
|
+
habitat dev stack doctor
|
|
46
|
+
habitat dev stack drain
|
|
47
|
+
habitat dev worktree cleanup --prefix wt- --trunk main
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
Commands target `--repository <path>` or the invoking directory. Mutators plan
|
|
51
|
+
by default; `--apply` executes and `--dry-run` overrides it. Optional repeated
|
|
52
|
+
`--scratch-file` inputs check only those files, with warning or explicit
|
|
53
|
+
`--scratch-mode block`; Habitat assumes no personal document layout.
|
|
54
|
+
|
|
55
|
+
Upstream sync fast-forwards the current checkout from its Git-configured upstream
|
|
56
|
+
or paired `--remote`/`--branch` override. It creates no integration branch and
|
|
57
|
+
does not maintain Graphite ancestry. Cleanup requires an explicit local trunk,
|
|
58
|
+
preserves current/pinned/detached/locked/trunk worktrees and defaults to merged
|
|
59
|
+
branches only. A failed native removal stops the remaining removals; there is no
|
|
60
|
+
force removal or branch deletion.
|
|
61
|
+
|
|
62
|
+
Stack drain submits the current downstack and requests one native Graphite
|
|
63
|
+
merge. `Requested` means accepted submission, not completed merging. After the
|
|
64
|
+
operator or workstream verifies actual merge completion, use Graphite's native
|
|
65
|
+
`gt sync --force --no-restack --no-interactive` once. The forced sync has native
|
|
66
|
+
repository-wide update/cleanup scope; protect unrelated work before invoking it.
|
|
67
|
+
Habitat does not implement a polling, resubmission or automatic cleanup loop.
|
|
68
|
+
|
|
18
69
|
## Create A Repository
|
|
19
70
|
|
|
20
71
|
Nx invokes the package's Bun-only `preset` generator while creating the workspace:
|
|
@@ -52,12 +103,57 @@ Later package releases use ordinary Nx migrations:
|
|
|
52
103
|
```sh
|
|
53
104
|
bunx nx migrate @habitat-ai/cli@latest
|
|
54
105
|
bun install
|
|
55
|
-
bunx nx migrate --run-migrations
|
|
56
106
|
```
|
|
57
107
|
|
|
58
108
|
The first command updates the fixed CLI/SDK pair and writes any applicable
|
|
59
|
-
Habitat migrations.
|
|
60
|
-
|
|
109
|
+
Habitat migrations. If Nx generated a nonempty migration plan, review it and
|
|
110
|
+
apply those package-owned repository changes:
|
|
111
|
+
|
|
112
|
+
```sh
|
|
113
|
+
bunx nx migrate --run-migrations=migrations.json
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
A package-only upgrade may correctly generate no migration file. Do not replay
|
|
117
|
+
an older plan or synthesize one. No consumer copies or independently maintains
|
|
118
|
+
the preset wiring.
|
|
119
|
+
|
|
120
|
+
**Windows is not supported in 0.7.0.** Habitat is tested and released on
|
|
121
|
+
Linux and macOS only; Windows is not tested in CI. In earlier hosted Windows
|
|
122
|
+
runs, the package-manager install inside `create-nx-workspace` and the install
|
|
123
|
+
of the new pair during an upgrade intermittently stalled past their deadlines,
|
|
124
|
+
with the cause not identified. The Windows policy behaviour described below is
|
|
125
|
+
kept in the CLI but is no longer tested.
|
|
126
|
+
|
|
127
|
+
**Windows policy checks:** Habitat can check explicit files with Grit on
|
|
128
|
+
Windows. If a selected Grit rule scans a directory, the CLI reports
|
|
129
|
+
`cannot evaluate on Windows`, marks the application as an error, and exits
|
|
130
|
+
nonzero from `habitat check`. This includes rules whose patterns might work
|
|
131
|
+
on Windows in isolation. Run the same selection on macOS or Linux to obtain
|
|
132
|
+
a verdict. The distinction is the input to Grit: a catalog rule that resolves
|
|
133
|
+
a directory or glob to an explicit file list still gets checked. The bundled
|
|
134
|
+
service v1 and resource v1 policies include direct directory scans; a new
|
|
135
|
+
preset does not select them automatically. Native structure checks are
|
|
136
|
+
unaffected. Codex agent-stop runs structure checks, not Grit.
|
|
137
|
+
|
|
138
|
+
Windows also limits the length of a native command line. A large explicit
|
|
139
|
+
file list may not fit; that check returns an error, not a partial result.
|
|
140
|
+
Run the full selection on macOS or Linux rather than dropping files.
|
|
141
|
+
|
|
142
|
+
Habitat's inferred Nx policy targets distinguish host platforms when they
|
|
143
|
+
run Grit, even for explicit files. Custom cacheable targets that wrap `habitat check`
|
|
144
|
+
must do the same or run uncached; a cached POSIX pass is not a Windows result.
|
|
145
|
+
|
|
146
|
+
**Existing services on the beta.51 oRPC cohort:** updating the CLI/SDK pair
|
|
147
|
+
does not change which service policy a repository selected. For the bundled
|
|
148
|
+
service blueprint, change the service's own `habitat.toml` from version 3
|
|
149
|
+
to 5, or from 4 to 6, preserving its existing base policy. Do not infer the
|
|
150
|
+
selection from the installed package version. From the workspace root, run
|
|
151
|
+
`habitat resolve --json`, then `habitat check --owner <project> --json`.
|
|
152
|
+
Look for the evaluated `service_v5_effect_bridge` or `service_v6_effect_bridge`
|
|
153
|
+
rule. A pass on the older rule does not cover the renamed bridge. Align any
|
|
154
|
+
direct native dependencies with the selected SDK; a single physical oRPC
|
|
155
|
+
and Effect installation is required. Plain handlers need no bootstrap;
|
|
156
|
+
Effect services use only the SDK facade in `src/service/impl.ts`.
|
|
61
157
|
|
|
62
158
|
Habitat `0.5.3` used Nx `23.1.0`, whose provenance reader predates npm 12. When
|
|
63
159
|
that exact historical pair is upgraded under npm 12, pin the migration CLI and
|
|
@@ -67,7 +163,7 @@ the final command applies the repository changes:
|
|
|
67
163
|
|
|
68
164
|
```sh
|
|
69
165
|
NX_MIGRATE_CLI_VERSION=23.1.1 NX_SKIP_PROVENANCE_CHECK=true \
|
|
70
|
-
bunx nx migrate @habitat-ai/cli@0.
|
|
166
|
+
bunx nx migrate @habitat-ai/cli@0.6.0
|
|
71
167
|
bun install
|
|
72
168
|
NX_MIGRATE_CLI_VERSION=23.1.1 NX_SKIP_PROVENANCE_CHECK=true \
|
|
73
169
|
bunx nx migrate --run-migrations=migrations.json --no-interactive
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { n as runHabitatProcess } from "./cli-DxjKzwlV.js";
|
|
2
|
+
import { T as contract } from "./habitat.app-CgdXa2f2.js";
|
|
3
|
+
import { n as sourceBundle } from "./oclif-DBwcAyVK.js";
|
|
4
|
+
import { createRequire } from "node:module";
|
|
5
|
+
import { resolve } from "node:path";
|
|
6
|
+
import { randomUUID } from "node:crypto";
|
|
7
|
+
//#region runtime/sources.ts
|
|
8
|
+
const require = createRequire(import.meta.url);
|
|
9
|
+
/** Deployment locators and caller input are explicit values, not a cached provider acquisition. */
|
|
10
|
+
function runtimeSources(appRoot, workspaceRoot) {
|
|
11
|
+
const timeoutInput = process.env.HABITAT_COMMAND_TIMEOUT_MS;
|
|
12
|
+
const timeoutMs = timeoutInput === void 0 ? 6e5 : Number(timeoutInput);
|
|
13
|
+
if (!Number.isInteger(timeoutMs) || timeoutMs < 1 || timeoutMs > 6e5) throw new TypeError("HABITAT_COMMAND_TIMEOUT_MS must be an integer from 1 through 600000.");
|
|
14
|
+
const gritEntrypoint = require.resolve("@getgrit/cli/run-grit.js");
|
|
15
|
+
return {
|
|
16
|
+
appRoot,
|
|
17
|
+
memory: {
|
|
18
|
+
"habitat.catalog.scope": { workspaceRoot: resolve(workspaceRoot) },
|
|
19
|
+
"habitat.catalog.config": { policyPack: {
|
|
20
|
+
name: "@habitat-ai/sdk",
|
|
21
|
+
packageJsonPath: require.resolve("@habitat-ai/sdk/package.json"),
|
|
22
|
+
manifestPath: require.resolve("@habitat-ai/sdk/habitat-pack.json")
|
|
23
|
+
} },
|
|
24
|
+
"habitat.source-inventory": {},
|
|
25
|
+
"habitat.telemetry": telemetryConfiguration(),
|
|
26
|
+
"habitat.rule-evaluation": {
|
|
27
|
+
command: process.platform === "win32" ? "node" : gritEntrypoint,
|
|
28
|
+
args: process.platform === "win32" ? [gritEntrypoint] : [],
|
|
29
|
+
timeoutMs
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
function telemetryConfiguration() {
|
|
35
|
+
const raw = process.env.HABITAT_TELEMETRY;
|
|
36
|
+
let value = { enabled: false };
|
|
37
|
+
if (raw !== void 0) try {
|
|
38
|
+
value = JSON.parse(raw);
|
|
39
|
+
} catch {
|
|
40
|
+
throw new TypeError("HABITAT_TELEMETRY must contain valid JSON.");
|
|
41
|
+
}
|
|
42
|
+
if (typeof value !== "object" || value === null || Array.isArray(value) || "processIdentity" in value) throw new TypeError("HABITAT_TELEMETRY must be a provider configuration without processIdentity.");
|
|
43
|
+
return {
|
|
44
|
+
...value,
|
|
45
|
+
processIdentity: {
|
|
46
|
+
serviceName: "habitat",
|
|
47
|
+
processRole: "cli",
|
|
48
|
+
deploymentEnvironment: "local",
|
|
49
|
+
processInstanceId: randomUUID()
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
//#endregion
|
|
54
|
+
//#region src/application.ts
|
|
55
|
+
/** Run one app-selected process; the native host owns dispatch and finalization. */
|
|
56
|
+
function executeHabitat(input) {
|
|
57
|
+
return runHabitatProcess({
|
|
58
|
+
...input,
|
|
59
|
+
sources: () => runtimeSources(input.appRoot, input.workspaceRoot),
|
|
60
|
+
sourceBundle,
|
|
61
|
+
terminal: true
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
/** A bounded native invocation returns only validated data, never an escaped managed client. */
|
|
65
|
+
async function resolveCatalogForWorkspace(input) {
|
|
66
|
+
const value = await runHabitatProcess({
|
|
67
|
+
...input,
|
|
68
|
+
args: ["resolve"],
|
|
69
|
+
sources: () => runtimeSources(input.appRoot, input.workspaceRoot),
|
|
70
|
+
sourceBundle,
|
|
71
|
+
terminal: false
|
|
72
|
+
});
|
|
73
|
+
const schemas = contract.catalog.resolve["~orpc"].outputSchemas;
|
|
74
|
+
if (schemas?.length !== 1 || schemas[0] === void 0) throw new TypeError("Catalog resolve must declare its output schema.");
|
|
75
|
+
const result = await schemas[0]["~standard"].validate(value);
|
|
76
|
+
if (result.issues !== void 0) throw new TypeError("Native catalog invocation returned an invalid result.");
|
|
77
|
+
return result.value;
|
|
78
|
+
}
|
|
79
|
+
//#endregion
|
|
80
|
+
export { resolveCatalogForWorkspace as n, executeHabitat as t };
|
package/dist/application.js
CHANGED
|
@@ -1,18 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
import { bindHabitatClient } from "./lib/binding.js";
|
|
4
|
-
/**
|
|
5
|
-
* Runs one native Oclif invocation over the app-selected Habitat client.
|
|
6
|
-
*
|
|
7
|
-
* Oclif owns command discovery and dispatch; this boundary supplies only the
|
|
8
|
-
* ready workspace client required by the Habitat commands.
|
|
9
|
-
*/
|
|
10
|
-
export async function executeHabitat({ appRoot, workspaceRoot, args, development, }) {
|
|
11
|
-
settings.enableAutoTranspile = development === true;
|
|
12
|
-
const client = await createHabitatClientForWorkspace(workspaceRoot);
|
|
13
|
-
return execute({
|
|
14
|
-
...(args === undefined ? {} : { args }),
|
|
15
|
-
...(development === undefined ? {} : { development }),
|
|
16
|
-
loadOptions: bindHabitatClient({ root: appRoot }, client),
|
|
17
|
-
});
|
|
18
|
-
}
|
|
1
|
+
import { n as resolveCatalogForWorkspace, t as executeHabitat } from "./application-Idvdhc9h.js";
|
|
2
|
+
export { executeHabitat, resolveCatalogForWorkspace };
|