@metaobjectsdev/cli 1.0.1 → 1.0.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.
- package/README.md +1 -1
- package/dist/src/commands/deps.d.ts +3 -0
- package/dist/src/commands/deps.d.ts.map +1 -0
- package/dist/src/commands/deps.js +200 -0
- package/dist/src/commands/deps.js.map +1 -0
- package/dist/src/commands/docs.d.ts.map +1 -1
- package/dist/src/commands/docs.js +19 -3
- package/dist/src/commands/docs.js.map +1 -1
- package/dist/src/commands/gen.d.ts.map +1 -1
- package/dist/src/commands/gen.js +54 -1
- package/dist/src/commands/gen.js.map +1 -1
- package/dist/src/commands/init.d.ts.map +1 -1
- package/dist/src/commands/init.js +12 -18
- package/dist/src/commands/init.js.map +1 -1
- package/dist/src/commands/migrate.d.ts.map +1 -1
- package/dist/src/commands/migrate.js +34 -33
- package/dist/src/commands/migrate.js.map +1 -1
- package/dist/src/commands/prompt-snapshot.d.ts.map +1 -1
- package/dist/src/commands/prompt-snapshot.js +2 -1
- package/dist/src/commands/prompt-snapshot.js.map +1 -1
- package/dist/src/commands/verify.d.ts.map +1 -1
- package/dist/src/commands/verify.js +154 -23
- package/dist/src/commands/verify.js.map +1 -1
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +62 -2
- package/dist/src/index.js.map +1 -1
- package/dist/src/lib/agent-context-staleness.d.ts.map +1 -1
- package/dist/src/lib/agent-context-staleness.js +7 -1
- package/dist/src/lib/agent-context-staleness.js.map +1 -1
- package/dist/src/lib/allow.d.ts.map +1 -1
- package/dist/src/lib/allow.js +7 -1
- package/dist/src/lib/allow.js.map +1 -1
- package/dist/src/lib/args.d.ts +57 -1
- package/dist/src/lib/args.d.ts.map +1 -1
- package/dist/src/lib/args.js +39 -2
- package/dist/src/lib/args.js.map +1 -1
- package/dist/src/lib/collection-load-options.d.ts +13 -0
- package/dist/src/lib/collection-load-options.d.ts.map +1 -0
- package/dist/src/lib/collection-load-options.js +19 -0
- package/dist/src/lib/collection-load-options.js.map +1 -0
- package/dist/src/lib/dependency-sync.d.ts +170 -0
- package/dist/src/lib/dependency-sync.d.ts.map +1 -0
- package/dist/src/lib/dependency-sync.js +457 -0
- package/dist/src/lib/dependency-sync.js.map +1 -0
- package/dist/src/lib/migrate-scope.d.ts +32 -1
- package/dist/src/lib/migrate-scope.d.ts.map +1 -1
- package/dist/src/lib/migrate-scope.js +51 -3
- package/dist/src/lib/migrate-scope.js.map +1 -1
- package/dist/src/lib/overlay-lint.d.ts +37 -0
- package/dist/src/lib/overlay-lint.d.ts.map +1 -0
- package/dist/src/lib/overlay-lint.js +102 -0
- package/dist/src/lib/overlay-lint.js.map +1 -0
- package/dist/src/lib/requirement-check.d.ts +9 -1
- package/dist/src/lib/requirement-check.d.ts.map +1 -1
- package/dist/src/lib/requirement-check.js +23 -7
- package/dist/src/lib/requirement-check.js.map +1 -1
- package/package.json +10 -10
- package/src/commands/deps.ts +231 -0
- package/src/commands/docs.ts +19 -3
- package/src/commands/gen.ts +61 -1
- package/src/commands/init.ts +13 -17
- package/src/commands/migrate.ts +36 -29
- package/src/commands/prompt-snapshot.ts +2 -1
- package/src/commands/verify.ts +174 -23
- package/src/index.ts +62 -2
- package/src/lib/agent-context-staleness.ts +7 -1
- package/src/lib/allow.ts +7 -1
- package/src/lib/args.ts +89 -3
- package/src/lib/collection-load-options.ts +36 -0
- package/src/lib/dependency-sync.ts +656 -0
- package/src/lib/migrate-scope.ts +59 -4
- package/src/lib/overlay-lint.ts +129 -0
- package/src/lib/requirement-check.ts +33 -7
package/src/lib/args.ts
CHANGED
|
@@ -296,7 +296,17 @@ export interface VerifyFlags {
|
|
|
296
296
|
* read as that flag's opposite rather than as a replay depth.
|
|
297
297
|
*/
|
|
298
298
|
replaySnapshot: boolean;
|
|
299
|
-
/**
|
|
299
|
+
/**
|
|
300
|
+
* Dependency drift (Task 15, FR-023) — re-resolve each declared dependency and
|
|
301
|
+
* compare its installed artifact's hash against `.metaobjects/deps.lock.json`
|
|
302
|
+
* (the same comparison `meta deps check` runs). Deliberately NEVER part of the
|
|
303
|
+
* bare-verify default, unlike --templates: it needs the publisher reachable,
|
|
304
|
+
* which CI may not have. It is still counted in `anyExplicit`, same as
|
|
305
|
+
* --codegen/--docs, so a lone `verify --deps` does not ALSO run the template
|
|
306
|
+
* gate.
|
|
307
|
+
*/
|
|
308
|
+
deps: boolean;
|
|
309
|
+
/** Whether ANY explicit subverb flag (--templates/--db/--codegen/--docs/--deps/--replay*) was passed. */
|
|
300
310
|
anyExplicit: boolean;
|
|
301
311
|
/** Suppress the advisory anti-pattern (verify-as-teacher) pass. */
|
|
302
312
|
noAntipatterns: boolean;
|
|
@@ -308,6 +318,16 @@ export interface VerifyFlags {
|
|
|
308
318
|
* the half that CAN fail a build switched on. Same shape as --no-antipatterns.
|
|
309
319
|
*/
|
|
310
320
|
noRequirementLint: boolean;
|
|
321
|
+
/**
|
|
322
|
+
* Suppress the advisory overlay AUTHORING lint (FR-023 §11.1 item 4) — the
|
|
323
|
+
* finding that an unflagged cross-file redeclaration works today only
|
|
324
|
+
* because the parser's default merge rule reuses the existing node by
|
|
325
|
+
* (type, resolutionKey); it silently becomes a NEW object the day the
|
|
326
|
+
* target is renamed or removed upstream. Same shape as
|
|
327
|
+
* --no-requirement-lint: mutes the advisory half only, never a gate (this
|
|
328
|
+
* lint has no gate half at all — it can never fail the build).
|
|
329
|
+
*/
|
|
330
|
+
noOverlayLint: boolean;
|
|
311
331
|
/**
|
|
312
332
|
* ADR-0023 strict-attr load opt-OUT (#96). `verify` is strict-by-default — an
|
|
313
333
|
* undeclared/typo'd own `@attr` fails verify (ERR_UNKNOWN_ATTR). `--lax`
|
|
@@ -342,10 +362,12 @@ export const VERIFY_OPTIONS = {
|
|
|
342
362
|
templates: { type: "boolean", default: false },
|
|
343
363
|
codegen: { type: "boolean", default: false },
|
|
344
364
|
docs: { type: "boolean", default: false },
|
|
365
|
+
deps: { type: "boolean", default: false },
|
|
345
366
|
replay: { type: "boolean", default: false },
|
|
346
367
|
"replay-snapshot": { type: "boolean", default: false },
|
|
347
368
|
"no-antipatterns": { type: "boolean", default: false },
|
|
348
369
|
"no-requirement-lint": { type: "boolean", default: false },
|
|
370
|
+
"no-overlay-lint": { type: "boolean", default: false },
|
|
349
371
|
lax: { type: "boolean", default: false },
|
|
350
372
|
"d1": { type: "string" },
|
|
351
373
|
"remote": { type: "boolean", default: false },
|
|
@@ -397,15 +419,17 @@ export function parseVerifyArgs(argv: string[]): VerifyFlags {
|
|
|
397
419
|
const templates = !!values.templates;
|
|
398
420
|
const codegen = !!values.codegen;
|
|
399
421
|
const docs = !!values.docs;
|
|
422
|
+
const deps = !!values.deps;
|
|
400
423
|
const replay = !!values.replay;
|
|
401
424
|
const replaySnapshot = !!values["replay-snapshot"];
|
|
402
425
|
// --db is itself an explicit subverb selector: passing a connection URL means
|
|
403
426
|
// "run the schema-drift mode". So is `--dialect d1` (D1 has no --db connection
|
|
404
427
|
// URL — see the `d1` field doc above). The replay flags are subverbs too, and
|
|
405
428
|
// must be listed here or `meta verify --replay` would ALSO run the template gate
|
|
406
|
-
// as the bare-verify default.
|
|
429
|
+
// as the bare-verify default. --deps joins the same list for the same reason —
|
|
430
|
+
// it must NOT also be part of that default (see the VerifyFlags doc on `deps`).
|
|
407
431
|
const anyExplicit =
|
|
408
|
-
templates || codegen || docs || values.db !== undefined || dialect === "d1" || replay || replaySnapshot;
|
|
432
|
+
templates || codegen || docs || deps || values.db !== undefined || dialect === "d1" || replay || replaySnapshot;
|
|
409
433
|
|
|
410
434
|
return {
|
|
411
435
|
prompts: values.prompts,
|
|
@@ -416,11 +440,13 @@ export function parseVerifyArgs(argv: string[]): VerifyFlags {
|
|
|
416
440
|
templates,
|
|
417
441
|
codegen,
|
|
418
442
|
docs,
|
|
443
|
+
deps,
|
|
419
444
|
replay,
|
|
420
445
|
replaySnapshot,
|
|
421
446
|
anyExplicit,
|
|
422
447
|
noAntipatterns: !!values["no-antipatterns"],
|
|
423
448
|
noRequirementLint: !!values["no-requirement-lint"],
|
|
449
|
+
noOverlayLint: !!values["no-overlay-lint"],
|
|
424
450
|
lax: !!values.lax,
|
|
425
451
|
d1: values.d1 as string | undefined,
|
|
426
452
|
remote: !!values.remote,
|
|
@@ -607,3 +633,63 @@ export function parseEjectArgs(argv: string[]): EjectFlags {
|
|
|
607
633
|
force: !!values.force,
|
|
608
634
|
};
|
|
609
635
|
}
|
|
636
|
+
|
|
637
|
+
// ---------------------------------------------------------------------------
|
|
638
|
+
// deps flags — FR-023 Phase 1a Task 14
|
|
639
|
+
// ---------------------------------------------------------------------------
|
|
640
|
+
|
|
641
|
+
/** `meta deps`'s subcommand. `sync` and `list` are this task's; `check` is
|
|
642
|
+
* parsed (so the grammar and its usage errors are stable now) but not yet
|
|
643
|
+
* implemented — Task 15 wires its behavior. */
|
|
644
|
+
export type DepsSubverb = "sync" | "check" | "list";
|
|
645
|
+
|
|
646
|
+
const DEPS_SUBVERBS: readonly DepsSubverb[] = ["sync", "check", "list"];
|
|
647
|
+
|
|
648
|
+
export interface DepsFlags {
|
|
649
|
+
subverb: DepsSubverb;
|
|
650
|
+
/** Dependency names to narrow to — `sync`'s `[<name>…]`. Empty means "all
|
|
651
|
+
* declared dependencies." Accepted (and ignored) by every subverb rather
|
|
652
|
+
* than rejected outright: the positional grammar is one shape for all
|
|
653
|
+
* three, and only `sync` gives the list meaning today. */
|
|
654
|
+
names: string[];
|
|
655
|
+
/** `sync` only: plan and report, write nothing. */
|
|
656
|
+
dryRun: boolean;
|
|
657
|
+
}
|
|
658
|
+
|
|
659
|
+
/** The flag table `parseDepsArgs` parses. Exported so the help text can be
|
|
660
|
+
* gated against it. Deliberately carries no "format" key: `--format` is a
|
|
661
|
+
* GLOBAL flag `index.ts` strips from argv before any command's parser ever
|
|
662
|
+
* runs (see `MIGRATE_OPTIONS`'s "--migration-format, not --format" note
|
|
663
|
+
* above) — `meta deps` becomes format-aware by index.ts adding "deps" to
|
|
664
|
+
* `FORMAT_AWARE_COMMANDS` and passing the resolved `fmt` through, exactly as
|
|
665
|
+
* gen/verify/migrate do, not by re-declaring the flag here. */
|
|
666
|
+
export const DEPS_OPTIONS = {
|
|
667
|
+
"dry-run": { type: "boolean", default: false },
|
|
668
|
+
} as const;
|
|
669
|
+
|
|
670
|
+
export function parseDepsArgs(argv: string[]): DepsFlags {
|
|
671
|
+
const { values, positionals } = parseArgs({
|
|
672
|
+
args: argv,
|
|
673
|
+
options: DEPS_OPTIONS,
|
|
674
|
+
strict: true,
|
|
675
|
+
allowPositionals: true,
|
|
676
|
+
});
|
|
677
|
+
|
|
678
|
+
const [subverbRaw, ...names] = positionals;
|
|
679
|
+
if (subverbRaw === undefined) {
|
|
680
|
+
throw new Error(
|
|
681
|
+
"meta deps requires a subcommand: sync | check | list. Try `meta deps sync`.",
|
|
682
|
+
);
|
|
683
|
+
}
|
|
684
|
+
if (!DEPS_SUBVERBS.includes(subverbRaw as DepsSubverb)) {
|
|
685
|
+
throw new Error(
|
|
686
|
+
`meta deps: unknown subcommand "${subverbRaw}"; expected one of: ${DEPS_SUBVERBS.join(", ")}.`,
|
|
687
|
+
);
|
|
688
|
+
}
|
|
689
|
+
|
|
690
|
+
return {
|
|
691
|
+
subverb: subverbRaw as DepsSubverb,
|
|
692
|
+
names,
|
|
693
|
+
dryRun: !!values["dry-run"],
|
|
694
|
+
};
|
|
695
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
// server/typescript/packages/cli/src/lib/collection-load-options.ts
|
|
2
|
+
//
|
|
3
|
+
// FR-023 — everything a resolved `Collection` contributes to a metadata LOAD,
|
|
4
|
+
// in one helper.
|
|
5
|
+
//
|
|
6
|
+
// One helper rather than four properties spread by hand at each of the nine
|
|
7
|
+
// `loadMemory` call sites, for the reason `loadMemoryOptionsFrom` exists next
|
|
8
|
+
// door (#333): threading one and forgetting another is how a capability reaches
|
|
9
|
+
// some commands and not others. Here the stakes are higher than a missing
|
|
10
|
+
// provider — a site that passes `files` alone loads a dependency's artifact
|
|
11
|
+
// under a local-looking source id AND loses the
|
|
12
|
+
// `ERR_DEPENDENCY_PACKAGE_NOT_OWNED` refusal, so a node declared into a
|
|
13
|
+
// dependency's package is silently excluded from that command's output instead
|
|
14
|
+
// of being refused by name.
|
|
15
|
+
import type { Collection, LoadMemoryOptions } from "@metaobjectsdev/sdk";
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* The load half of a `Collection`: the resolved file list (dependency artifacts
|
|
19
|
+
* first, then the project's own files), the `dep:<name>/<artifact>` source ids
|
|
20
|
+
* those artifacts load under, and the two imported sets the ownership refusal
|
|
21
|
+
* reads.
|
|
22
|
+
*
|
|
23
|
+
* The return type is a `Pick` of {@link LoadMemoryOptions} rather than a
|
|
24
|
+
* hand-written shape, so renaming or retyping an option there is a compile
|
|
25
|
+
* error here rather than a silently-dropped key.
|
|
26
|
+
*/
|
|
27
|
+
export function collectionLoadOptions(
|
|
28
|
+
collection: Collection,
|
|
29
|
+
): Required<Pick<LoadMemoryOptions, "files" | "fileIds" | "importedPackages" | "importedNodes">> {
|
|
30
|
+
return {
|
|
31
|
+
files: collection.files,
|
|
32
|
+
fileIds: collection.fileIds,
|
|
33
|
+
importedPackages: collection.importedPackages,
|
|
34
|
+
importedNodes: collection.importedNodes,
|
|
35
|
+
};
|
|
36
|
+
}
|