@animus-ui/cli 0.1.11 → 0.1.14
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 +33 -13
- package/bin/animus.mjs +13 -4
- package/dist/build.d.ts +3 -38
- package/dist/build.d.ts.map +1 -1
- package/dist/config.d.ts +24 -20
- package/dist/config.d.ts.map +1 -1
- package/dist/index.cjs +445 -312
- package/dist/index.d.ts +8 -19
- package/dist/index.d.ts.map +1 -1
- package/dist/index.mjs +448 -316
- package/dist/signals.d.ts +23 -0
- package/dist/signals.d.ts.map +1 -0
- package/dist/watch.d.ts +5 -54
- package/dist/watch.d.ts.map +1 -1
- package/dist/writer.d.ts +22 -39
- package/dist/writer.d.ts.map +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -36,25 +36,45 @@ animus print-config --root . --system ./src/ds.ts
|
|
|
36
36
|
Configuration lives in `animus.config.{json,mjs,js,ts}` (probed in that
|
|
37
37
|
order; `.ts` needs Node >= 23.6 native type stripping — older runtimes get
|
|
38
38
|
a guided error naming the `.mjs`/`.json` remedy). Flags override file
|
|
39
|
-
values; `--exclude` merges
|
|
40
|
-
|
|
39
|
+
values; `--exclude` merges, and an explicit `exclude: []` in the config file
|
|
40
|
+
means no user exclusions (the replaceable defaults are not restored).
|
|
41
|
+
`animus print-config` prints the fully resolved configuration as JSON on
|
|
42
|
+
stdout with per-key provenance, including `extensions` and `staticCss`.
|
|
41
43
|
|
|
42
44
|
Stream discipline is a contract: **stdout carries machine output only**;
|
|
43
45
|
every human-facing line goes to stderr.
|
|
44
46
|
|
|
47
|
+
## `--strict`
|
|
48
|
+
|
|
49
|
+
`--strict` fails the build on every diagnostic that means **a configured
|
|
50
|
+
input could not be read or resolved** — an include or entry that does not
|
|
51
|
+
resolve, a configured file that cannot be read, a configured package or
|
|
52
|
+
path that cannot be found, registered vocabulary that never reaches the
|
|
53
|
+
build. Genuine degradation stays a warning in every mode (per-property
|
|
54
|
+
skips, name collisions, unsupported-value fallbacks): the artifacts are
|
|
55
|
+
complete, so failing on them would contradict the engine's per-property
|
|
56
|
+
degradation design. Without `--strict` those same input failures print as
|
|
57
|
+
warnings and the build exits 0.
|
|
58
|
+
|
|
45
59
|
## Exit codes
|
|
46
60
|
|
|
47
|
-
| Code | Meaning
|
|
48
|
-
| ---- |
|
|
49
|
-
| 0 | Success — artifact set published and self-consistent
|
|
50
|
-
| 1 | Extraction failure (error diagnostics, `--strict` escalation, zero files, structural emptiness) |
|
|
51
|
-
| 2 | Config/usage error (unknown key, unresolvable system path, lock conflict)
|
|
52
|
-
| 3 | Engine/environment failure (native engine load, consistency-check failure)
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
61
|
+
| Code | Meaning |
|
|
62
|
+
| ---- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
63
|
+
| 0 | Success — artifact set published and self-consistent |
|
|
64
|
+
| 1 | Extraction failure (error diagnostics, `--strict` escalation, zero files, structural emptiness), or a system module that throws while loading (fatal in every mode) |
|
|
65
|
+
| 2 | Config/usage error (unknown key or command, unresolvable system path, `--out-dir` equal to the root, lock conflict) |
|
|
66
|
+
| 3 | Engine/environment failure (native engine load, consistency-check failure) |
|
|
67
|
+
| 4 | The `@animus-ui/cli` install could not be loaded (broken or partial install — reinstall) |
|
|
68
|
+
|
|
69
|
+
Both `animus build` and `animus watch` exit 130 on SIGINT and 143 on
|
|
70
|
+
SIGTERM, releasing the advisory lock and keeping last-good artifacts;
|
|
71
|
+
`animus watch` also exits 3 under `--fail-on-degraded` when any root
|
|
72
|
+
cannot be watched. `animus watch` drains the in-flight cycle first; a
|
|
73
|
+
second signal during that drain abandons the drain and exits at once,
|
|
74
|
+
still releasing the lock and removing the session tree. Watch readiness is
|
|
75
|
+
an explicit stderr event: wait for the `watch ready` line before starting
|
|
76
|
+
dependent steps — it is emitted after edits observed during the first
|
|
77
|
+
analysis have been analyzed and published, not merely after the first pass.
|
|
58
78
|
|
|
59
79
|
Silent-empty success is impossible: system-load failure, zero discovered
|
|
60
80
|
files, and structural emptiness are fatal in every mode.
|
package/bin/animus.mjs
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
//
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
|
|
2
|
+
// The literal repeats EXIT_INSTALL (src/index.ts) because that module is the
|
|
3
|
+
// one that did not load; the default rejection exit 1 reads as extraction.
|
|
4
|
+
import('../dist/index.mjs').then(
|
|
5
|
+
(mod) => mod.main(),
|
|
6
|
+
(error) => {
|
|
7
|
+
process.stderr.write(
|
|
8
|
+
`[animus] The @animus-ui/cli install could not be loaded: ${String(error)}\n` +
|
|
9
|
+
'[animus] This is an install failure, not an extraction failure — ' +
|
|
10
|
+
'reinstall @animus-ui/cli and check that its dist/ shipped.\n'
|
|
11
|
+
);
|
|
12
|
+
process.exit(4);
|
|
13
|
+
}
|
|
14
|
+
);
|
package/dist/build.d.ts
CHANGED
|
@@ -1,62 +1,27 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* `animus build` — one-shot extraction over the SAME drive loop every
|
|
3
|
-
* driver uses (`ExtractionSession`; NS1/NS4: no second composition), then
|
|
4
|
-
* export of the raw payloads to the fixed-path deterministic artifact
|
|
5
|
-
* contract (design D3) via the CLI writer. The one-shot session tree is
|
|
6
|
-
* removed after export — no session-dir accumulation per CI run.
|
|
7
|
-
*
|
|
8
|
-
* Failure policy (design D5): silent-empty success is impossible —
|
|
9
|
-
* system-load failure, zero discovered files, and structural emptiness are
|
|
10
|
-
* fatal in EVERY mode, independent of `strict`.
|
|
11
|
-
*
|
|
12
|
-
* The preflight, session construction, and shared-state publication steps
|
|
13
|
-
* are exported helpers: `animus watch` (watch.ts) runs the same checks and
|
|
14
|
-
* the same writer path per publication instead of forking them.
|
|
15
|
-
*/
|
|
16
1
|
import { ExtractionSession } from '@animus-ui/extract/session';
|
|
17
2
|
import type { ResolvedCliConfig } from './config';
|
|
18
|
-
/** Thrown for failures whose exit class is "extraction failure" (1). */
|
|
19
3
|
export declare class ExtractionFailure extends Error {
|
|
20
4
|
}
|
|
21
|
-
/** Thrown for failures whose exit class is "config/usage error" (2). */
|
|
22
5
|
export declare class UsageFailure extends Error {
|
|
23
6
|
}
|
|
24
|
-
/** Thrown for failures whose exit class is "engine/environment" (3). */
|
|
25
7
|
export declare class EnvironmentFailure extends Error {
|
|
26
8
|
}
|
|
27
|
-
/** The CLI's one stderr prefix convention (stdout stays machine-only) —
|
|
28
|
-
* shared with watch.ts. */
|
|
29
9
|
export declare const err: (...parts: unknown[]) => void;
|
|
30
10
|
export interface BuildResult {
|
|
31
11
|
outDir: string;
|
|
32
12
|
componentCount: number;
|
|
33
13
|
fileCount: number;
|
|
34
14
|
}
|
|
35
|
-
/**
|
|
36
|
-
*
|
|
37
|
-
* platform binary is an environment failure (exit 3) surfaced with the
|
|
38
|
-
* loader's own remediation text. */
|
|
15
|
+
/** Existence checks run before the engine loads, so a misconfigured
|
|
16
|
+
* project exits 2 rather than 3. */
|
|
39
17
|
export declare function runPreflight(config: ResolvedCliConfig): Promise<void>;
|
|
40
|
-
/** The one CLI session shape: self-ingestion guard applied (an outDir
|
|
41
|
-
* inside the root is force-excluded from discovery, loudly), driver label
|
|
42
|
-
* and root authority set, tsconfig `paths` harvested as the alias source
|
|
43
|
-
* (no live bundler config exists for this driver). */
|
|
44
18
|
export declare function createCliSession(config: ResolvedCliConfig): ExtractionSession;
|
|
45
19
|
export interface PublishOutcome {
|
|
46
20
|
componentCount: number;
|
|
47
21
|
fileCount: number;
|
|
48
22
|
}
|
|
49
|
-
/**
|
|
50
|
-
* Publish the session's shared-state payloads through the deterministic
|
|
51
|
-
* CLI writer (design D3) — the SINGLE publication path for build and every
|
|
52
|
-
* watch cycle. Zero analyzed files, an unreadable manifest, and structural
|
|
53
|
-
* emptiness throw ExtractionFailure (silent-empty success is impossible);
|
|
54
|
-
* a post-publish consistency failure throws EnvironmentFailure.
|
|
55
|
-
*/
|
|
56
23
|
export declare function publishSharedPayloads(config: ResolvedCliConfig, session: ExtractionSession): PublishOutcome;
|
|
57
|
-
|
|
58
|
-
* dead-pattern visibility — a user exclusion that matched nothing is
|
|
59
|
-
* named instead of silently inert. */
|
|
24
|
+
export declare function createRunClaimRelease(getSession: () => ExtractionSession | null, releaseLock: () => void): () => void;
|
|
60
25
|
export declare function reportDiscoveryOutcomes(config: ResolvedCliConfig, session: ExtractionSession): void;
|
|
61
26
|
export declare function runBuild(config: ResolvedCliConfig): Promise<BuildResult>;
|
|
62
27
|
//# sourceMappingURL=build.d.ts.map
|
package/dist/build.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build.d.ts","sourceRoot":"","sources":["../src/build.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"build.d.ts","sourceRoot":"","sources":["../src/build.ts"],"names":[],"mappings":"AAKA,OAAO,EAGL,iBAAiB,EAKlB,MAAM,4BAA4B,CAAC;AAcpC,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAGlD,qBAAa,iBAAkB,SAAQ,KAAK;CAAG;AAC/C,qBAAa,YAAa,SAAQ,KAAK;CAAG;AAC1C,qBAAa,kBAAmB,SAAQ,KAAK;CAAG;AAEhD,eAAO,MAAM,GAAG,aAAc,OAAO,EAAE,KAAG,IACL,CAAC;AAEtC,MAAM,WAAW,WAAW;IAC1B,MAAM,EAAE,MAAM,CAAC;IACf,cAAc,EAAE,MAAM,CAAC;IACvB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED;qCACqC;AACrC,wBAAsB,YAAY,CAAC,MAAM,EAAE,iBAAiB,GAAG,OAAO,CAAC,IAAI,CAAC,CAqB3E;AAED,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,iBAAiB,GAAG,iBAAiB,CAsC7E;AAED,MAAM,WAAW,cAAc;IAC7B,cAAc,EAAE,MAAM,CAAC;IACvB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,wBAAgB,qBAAqB,CACnC,MAAM,EAAE,iBAAiB,EACzB,OAAO,EAAE,iBAAiB,GACzB,cAAc,CA8DhB;AAqBD,wBAAgB,qBAAqB,CACnC,UAAU,EAAE,MAAM,iBAAiB,GAAG,IAAI,EAC1C,WAAW,EAAE,MAAM,IAAI,GACtB,MAAM,IAAI,CAOZ;AAED,wBAAgB,uBAAuB,CACrC,MAAM,EAAE,iBAAiB,EACzB,OAAO,EAAE,iBAAiB,GACzB,IAAI,CAgBN;AAED,wBAAsB,QAAQ,CAC5B,MAAM,EAAE,iBAAiB,GACxB,OAAO,CAAC,WAAW,CAAC,CAyCtB"}
|
package/dist/config.d.ts
CHANGED
|
@@ -1,14 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
* CLI config resolution — the third driver over the shared option core
|
|
3
|
-
* (shared-driver-config): documented precedence flags > config file >
|
|
4
|
-
* defaults, one root authority, explicit emission mode (the CLI never
|
|
5
|
-
* sniffs NODE_ENV), and a fully inspectable resolved projection for
|
|
6
|
-
* `--print-config`.
|
|
7
|
-
*/
|
|
8
|
-
import type { AnimusCoreOptions, AnimusMode, OptionProvenance } from '@animus-ui/extract/pipeline';
|
|
9
|
-
/** Config filenames probed in order under the config-search root. */
|
|
1
|
+
import type { AnimusCoreOptions, AnimusMode, OptionProvenance, StaticCssConfig } from '@animus-ui/extract/pipeline';
|
|
10
2
|
export declare const CONFIG_FILENAMES: readonly ['animus.config.json', 'animus.config.mjs', 'animus.config.js', 'animus.config.ts'];
|
|
11
|
-
/** The `cli:` driver namespace of the shared config schema. */
|
|
12
3
|
export interface CliNamespaceOptions {
|
|
13
4
|
/** Artifact output directory, relative to the root. @default '.animus' */
|
|
14
5
|
outDir?: string;
|
|
@@ -24,27 +15,40 @@ export interface CliFlags {
|
|
|
24
15
|
targets?: string;
|
|
25
16
|
exclude?: string[];
|
|
26
17
|
}
|
|
18
|
+
export type CliRootSource = 'flag' | 'config-file' | 'config-dir' | 'cwd';
|
|
27
19
|
export interface ResolvedCliConfig {
|
|
28
20
|
driver: 'cli';
|
|
29
21
|
/** Absolute root every relative input resolves against. */
|
|
30
22
|
root: string;
|
|
31
|
-
|
|
23
|
+
rootSource: CliRootSource;
|
|
32
24
|
configFile: string | null;
|
|
33
|
-
/** The effective core options handed to the session. */
|
|
34
25
|
options: AnimusCoreOptions;
|
|
35
26
|
/** Absolute artifact output directory. */
|
|
36
27
|
outDir: string;
|
|
37
|
-
/** Effective merged exclusion pattern list (defaults ∪ user). */
|
|
38
28
|
excludePatterns: readonly string[];
|
|
39
29
|
mode: AnimusMode;
|
|
40
30
|
provenance: Record<string, OptionProvenance>;
|
|
41
31
|
}
|
|
42
|
-
/**
|
|
43
|
-
* Resolve the effective CLI configuration. Precedence: flags > config file
|
|
44
|
-
* > documented defaults. Scalar flags override; `--exclude` values merge
|
|
45
|
-
* (exclusion semantics are merge-only by contract).
|
|
46
|
-
*/
|
|
47
32
|
export declare function resolveCliConfig(flags: CliFlags, cwd: string): Promise<ResolvedCliConfig>;
|
|
48
|
-
/**
|
|
49
|
-
|
|
33
|
+
/** Announced only for the root authority the invocation does not state:
|
|
34
|
+
* `--root` and a config-file `root` are the user's own words. */
|
|
35
|
+
export declare function inferredRootNotice(config: ResolvedCliConfig, cwd: string): string | null;
|
|
36
|
+
export declare function projectResolvedConfig(config: ResolvedCliConfig): {
|
|
37
|
+
driver: "cli";
|
|
38
|
+
root: string;
|
|
39
|
+
configFile: string | null;
|
|
40
|
+
outDir: string;
|
|
41
|
+
mode: AnimusMode;
|
|
42
|
+
system: string;
|
|
43
|
+
strict: boolean;
|
|
44
|
+
verbose: boolean;
|
|
45
|
+
targets: string | string[] | null;
|
|
46
|
+
minify: boolean | null;
|
|
47
|
+
prefix: string | null;
|
|
48
|
+
layers: string[] | null;
|
|
49
|
+
extensions: string[] | null;
|
|
50
|
+
staticCss: StaticCssConfig | null;
|
|
51
|
+
exclude: readonly string[];
|
|
52
|
+
provenance: Record<string, OptionProvenance>;
|
|
53
|
+
};
|
|
50
54
|
//# sourceMappingURL=config.d.ts.map
|
package/dist/config.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EACV,iBAAiB,EACjB,UAAU,EACV,gBAAgB,EAEhB,eAAe,EAChB,MAAM,6BAA6B,CAAC;AAErC,eAAO,MAAM,gBAAgB,YAC3B,oBAAoB,EACpB,mBAAmB,EACnB,kBAAkB,EAClB,kBAAkB,CACV,CAAC;AAEX,MAAM,WAAW,mBAAmB;IAClC,0EAA0E;IAC1E,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,QAAQ;IACvB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;CACpB;AAED,MAAM,MAAM,aAAa,GAAG,MAAM,GAAG,aAAa,GAAG,YAAY,GAAG,KAAK,CAAC;AAE1E,MAAM,WAAW,iBAAiB;IAChC,MAAM,EAAE,KAAK,CAAC;IACd,2DAA2D;IAC3D,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,aAAa,CAAC;IAC1B,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,OAAO,EAAE,iBAAiB,CAAC;IAC3B,0CAA0C;IAC1C,MAAM,EAAE,MAAM,CAAC;IACf,eAAe,EAAE,SAAS,MAAM,EAAE,CAAC;IACnC,IAAI,EAAE,UAAU,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAAC;CAC9C;AA6ND,wBAAsB,gBAAgB,CACpC,KAAK,EAAE,QAAQ,EACf,GAAG,EAAE,MAAM,GACV,OAAO,CAAC,iBAAiB,CAAC,CAkI5B;AAED;kEACkE;AAClE,wBAAgB,kBAAkB,CAChC,MAAM,EAAE,iBAAiB,EACzB,GAAG,EAAE,MAAM,GACV,MAAM,GAAG,IAAI,CAOf;AAED,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,iBAAiB;IAE3D,MAAM;IACN,IAAI;IACJ,UAAU;IACV,MAAM;IACN,IAAI;IACJ,MAAM;IACN,MAAM;IACN,OAAO;IACP,OAAO;IACP,MAAM;IACN,MAAM;IACN,MAAM;IACN,UAAU;IACV,SAAS;IACT,OAAO;IACP,UAAU;EAEb"}
|