cyber-agentkit 1.2.0 → 2.0.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/.claude-plugin/plugin.json +1 -1
- package/.codex-plugin/plugin.json +1 -1
- package/.cursor-plugin/plugin.json +1 -1
- package/CHANGELOG.md +181 -0
- package/dist/cli.js +8687 -4886
- package/dist/commands.d.ts +159 -87
- package/dist/commands.js +1099 -838
- package/dist/index.d.ts +335 -70
- package/dist/index.js +26 -22
- package/dist/reference-where-BsBpwLyg.d.ts +735 -0
- package/dist/{reference-where-C84J6MsR.js → reference-where-CVmGFOwR.js} +5468 -1864
- package/package.json +3 -2
- package/plugin.json +1 -1
- package/readme.md +59 -26
- package/skills/asset/scripts/asset.mjs +82 -69
- package/skills/prose-update/SKILL.md +1 -1
- package/skills/prose-update/scripts/prose-update.mjs +82 -69
- package/skills/reference/README.md +7 -7
- package/skills/reference/SKILL.md +64 -58
- package/skills/reference/references/create.md +29 -24
- package/skills/reference/references/customize.md +82 -0
- package/skills/reference/references/load.md +58 -37
- package/skills/reference/scripts/reference.mjs +82 -69
- package/dist/resolve-reference-D62VJZc0.d.ts +0 -246
package/dist/index.d.ts
CHANGED
|
@@ -1,27 +1,97 @@
|
|
|
1
1
|
import { n as harnessIds, t as HarnessId } from "./harness-id-BgKL-x6C.js";
|
|
2
|
-
import { A as
|
|
3
|
-
//#region src/references/
|
|
4
|
-
/** `
|
|
5
|
-
type
|
|
6
|
-
|
|
7
|
-
|
|
2
|
+
import { A as referenceLayers, B as ReferenceCode, C as ReferenceLayer, D as ReferenceTier, E as ReferencePlugin, F as ReferenceSourcePlugin, G as ReferenceWarning, H as ReferenceErrorCode, I as ReferenceTraceSource, J as referenceCodes, K as ReferenceWarningCode, L as ProjectFolder, M as userReferencesDir, N as GeneratedRecord, O as SkillDefaults, P as ReferenceSource, Q as AssetLayerOptions, R as ProjectFolderCache, S as PluginOrigin, T as ReferenceLayers, U as ReferenceNoticeCode, V as ReferenceCodeKind, W as ReferenceStatusCode, X as skillName, Y as FoundSkill, Z as skillsIn, _ as ResolvedProjectSection, a as AmbiguousCause, b as MergeOperation, c as ReferenceTrace, d as ReferenceTraceSection, et as AssetTier, f as ResolveOptions, g as ReferenceTraceProjectSection, h as resolveReference, i as whereReference, j as repoReferencesDir, k as defaultLayer, l as ReferenceTraceContribution, m as referenceNames, n as ReferenceWhereReport, nt as Platform, o as OperationSource, p as ResolvedReference, q as referenceCodeExit, r as WhereOptions, s as ReferenceStatus, t as ReferenceWhereFile, tt as AssetWarning, u as ReferenceTraceLayer, v as ReferenceName, w as ReferenceLayerOptions, x as SectionSource, y as parseReferenceName, z as ProjectFolders } from "./reference-where-BsBpwLyg.js";
|
|
3
|
+
//#region src/references/reference-stack.d.ts
|
|
4
|
+
/** One `sections` entry of a step: a top-level heading, and the operation it applies with when one is written. */
|
|
5
|
+
type StepSection = {
|
|
6
|
+
heading: string;
|
|
7
|
+
merge?: MergeOperation;
|
|
8
8
|
};
|
|
9
9
|
/**
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
* `invalid`, and one no contribution answers `missing`; neither throws.
|
|
10
|
+
* One `extends` entry: a plugin or `default`, with the keys to use for it in place of its own. With
|
|
11
|
+
* `sections`, it contributes only those top-level sections (R52).
|
|
13
12
|
*/
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
13
|
+
type ExtendsStep = {
|
|
14
|
+
target: string;
|
|
15
|
+
merge?: MergeOperation;
|
|
16
|
+
extends?: ExtendsStep[];
|
|
17
|
+
sections?: StepSection[];
|
|
18
|
+
};
|
|
19
|
+
//#endregion
|
|
20
|
+
//#region src/assets/asset-name.d.ts
|
|
21
|
+
type AssetFormat = 'markdown' | 'json' | 'yaml' | 'toml' | 'txt';
|
|
22
|
+
//#endregion
|
|
23
|
+
//#region src/assets/resolve-asset.d.ts
|
|
24
|
+
type AssetStatus = 'found' | 'missing' | 'ambiguous' | 'invalid';
|
|
25
|
+
/** One layer checked, as the trace reports it. */
|
|
26
|
+
type AssetTraceLayer = {
|
|
27
|
+
tier: AssetTier;
|
|
28
|
+
plugin?: string;
|
|
29
|
+
skill?: string;
|
|
30
|
+
/** The file matched, or the folder checked when none matched. */
|
|
31
|
+
path: string;
|
|
32
|
+
/** The file that answered, relative to the folder: `<name>.<ext>`. */
|
|
33
|
+
file?: string;
|
|
34
|
+
operation?: 'replace';
|
|
35
|
+
operationFrom?: 'default' | 'contribution';
|
|
36
|
+
/** `used`; `shadowed by ...`; `not used (...)`; `not read (...)`; `ambiguous`; or `missing`. */
|
|
37
|
+
outcome: string;
|
|
38
|
+
/** A file with nothing in it. */
|
|
39
|
+
empty?: boolean;
|
|
40
|
+
};
|
|
41
|
+
type AssetTraceContribution = {
|
|
42
|
+
tier: AssetTier;
|
|
43
|
+
plugin?: string;
|
|
44
|
+
skill?: string;
|
|
45
|
+
path: string;
|
|
46
|
+
operation: 'replace';
|
|
47
|
+
};
|
|
48
|
+
type AssetTrace = {
|
|
49
|
+
/** The plugins and `default` the name builds on, bottom first. */
|
|
50
|
+
stack: string[];
|
|
51
|
+
/** What decided the stack: `selection`, `qualified name`, or `none`. */
|
|
52
|
+
builtBy: string;
|
|
53
|
+
/** The contributions whose text the answer holds, bottom first. */
|
|
54
|
+
contributions: AssetTraceContribution[];
|
|
55
|
+
/** Always empty: an asset is never composed. Kept so the trace has the shape a reference trace has. */
|
|
56
|
+
sections: never[];
|
|
57
|
+
/** Every layer checked, highest first. */
|
|
58
|
+
layers: AssetTraceLayer[];
|
|
59
|
+
/** The harnesses detected, whose managed folders and enabled plugins were read. */
|
|
60
|
+
harnesses: string[];
|
|
61
|
+
};
|
|
62
|
+
/** A name resolved, with every field: the command prints a subset. A bad name is a status, never thrown. */
|
|
63
|
+
type ResolvedAsset = {
|
|
64
|
+
name: string;
|
|
65
|
+
status: AssetStatus;
|
|
66
|
+
/** Set when not `found`. */
|
|
67
|
+
code?: 'reference-missing' | 'reference-ambiguous' | 'reference-invalid';
|
|
68
|
+
/** Why it is not `found`, for a person. */
|
|
69
|
+
message?: string;
|
|
70
|
+
/** The file as written. */
|
|
71
|
+
content?: string;
|
|
72
|
+
/** Set when `found`: `markdown`, or the format of the data file that answered. */
|
|
73
|
+
format?: AssetFormat;
|
|
74
|
+
/** Always empty: an asset has no frontmatter that composes. */
|
|
75
|
+
metadata?: Record<string, unknown>;
|
|
76
|
+
/** When `ambiguous`: each `<plugin>/<name>`, and `default` when the skill has one. */
|
|
77
|
+
options?: string[];
|
|
78
|
+
cause?: 'unordered';
|
|
79
|
+
warnings: AssetWarning[];
|
|
80
|
+
trace: AssetTrace;
|
|
81
|
+
};
|
|
17
82
|
//#endregion
|
|
18
83
|
//#region src/assets/load-asset.d.ts
|
|
84
|
+
/** `assetLayers`' options, with the machine's own home directory, platform, and environment by default. */
|
|
85
|
+
type LoadAssetOptions = Omit<AssetLayerOptions, 'home' | 'platform'> & {
|
|
86
|
+
home?: string | undefined;
|
|
87
|
+
platform?: Platform | undefined;
|
|
88
|
+
};
|
|
19
89
|
/**
|
|
20
|
-
* Resolves one asset by name the way `asset load` does
|
|
21
|
-
*
|
|
22
|
-
*
|
|
90
|
+
* Resolves one asset by name the way `asset load` does, reading `assets/` folders through the tiers.
|
|
91
|
+
* A data file answers whole from the highest tier holding the name; the skill's own
|
|
92
|
+
* `assets/<name>.<ext>` (`defaultSkill`) is the lowest.
|
|
23
93
|
*/
|
|
24
|
-
export declare function loadAsset(name: string, options:
|
|
94
|
+
export declare function loadAsset(name: string, options: LoadAssetOptions): Promise<ResolvedAsset>;
|
|
25
95
|
//#endregion
|
|
26
96
|
//#region src/harness/harness-environment.d.ts
|
|
27
97
|
/**
|
|
@@ -517,6 +587,20 @@ export declare function parseHistory(text: string): ParsedHistory;
|
|
|
517
587
|
*/
|
|
518
588
|
export declare function retire(history: string, wording: string, date: string, reason: string): string;
|
|
519
589
|
//#endregion
|
|
590
|
+
//#region src/references/load-reference.d.ts
|
|
591
|
+
/** `referenceLayers`' options, with the machine's own home directory, platform, and environment by default. */
|
|
592
|
+
type LoadReferenceOptions = Omit<ReferenceLayerOptions, 'home' | 'platform'> & {
|
|
593
|
+
home?: string | undefined;
|
|
594
|
+
platform?: Platform | undefined;
|
|
595
|
+
};
|
|
596
|
+
/**
|
|
597
|
+
* Resolves one reference for the root the way `reference load` does, returning the full record: every
|
|
598
|
+
* field `load` prints with `--metadata` and `--trace`. A name that is not a reference name comes back
|
|
599
|
+
* `invalid`, and one no contribution answers `missing`; neither throws. An empty name throws
|
|
600
|
+
* `ReferenceFailure` with `name-missing`, and a `root` that does not exist with `root-missing`.
|
|
601
|
+
*/
|
|
602
|
+
export declare function loadReference(name: string, options: LoadReferenceOptions): Promise<ResolvedReference>;
|
|
603
|
+
//#endregion
|
|
520
604
|
//#region src/references/reference-catalog.d.ts
|
|
521
605
|
/** One row per name. */
|
|
522
606
|
type ReferenceListRow = {
|
|
@@ -524,9 +608,12 @@ type ReferenceListRow = {
|
|
|
524
608
|
name: string;
|
|
525
609
|
description: string;
|
|
526
610
|
status: ReferenceStatus;
|
|
611
|
+
/** Set when not `found`. */
|
|
612
|
+
code?: ReferenceStatusCode;
|
|
527
613
|
/** When `ambiguous`: each `<plugin>/<name>`, and each skill's default as `default of <skill>`. */
|
|
528
614
|
options?: string[];
|
|
529
615
|
};
|
|
616
|
+
type ReferenceListRowKind = 'selection' | 'generated' | 'project-section';
|
|
530
617
|
/** One row per name per layer holding it, with the outcome that contribution gets. */
|
|
531
618
|
type ReferenceListLayerRow = {
|
|
532
619
|
name: string;
|
|
@@ -536,8 +623,10 @@ type ReferenceListLayerRow = {
|
|
|
536
623
|
path: string;
|
|
537
624
|
description: string;
|
|
538
625
|
outcome: string;
|
|
539
|
-
/**
|
|
540
|
-
|
|
626
|
+
/** What the row is, when it is one: a contribution with `extends` and no body, a generated document, or a project section. */
|
|
627
|
+
kind?: ReferenceListRowKind;
|
|
628
|
+
/** A project section's folder, relative to the root. */
|
|
629
|
+
folder?: string;
|
|
541
630
|
/** A skill's default: the `default` step reaches it when this skill loads the name. */
|
|
542
631
|
reachedBy?: string;
|
|
543
632
|
};
|
|
@@ -570,6 +659,8 @@ type SearchMatch = {
|
|
|
570
659
|
skill?: string;
|
|
571
660
|
/** A match found as this skill loads the name, its default joined. */
|
|
572
661
|
loadedBy?: string;
|
|
662
|
+
/** A match in a project section: its folder, relative to the root. */
|
|
663
|
+
folder?: string;
|
|
573
664
|
};
|
|
574
665
|
type ReferenceSearch = {
|
|
575
666
|
matches: SearchMatch[];
|
|
@@ -577,8 +668,8 @@ type ReferenceSearch = {
|
|
|
577
668
|
defaults?: string;
|
|
578
669
|
};
|
|
579
670
|
/**
|
|
580
|
-
* Every name resolves the way `
|
|
581
|
-
* no extends orders is searched once per plugin, as the qualified name `
|
|
671
|
+
* Every name resolves the way `load` would, and each skill's default as its skill loads it; a name
|
|
672
|
+
* no extends orders is searched once per plugin, as the qualified name `load` would need, and a name
|
|
582
673
|
* a `remove` turned off is left out.
|
|
583
674
|
*/
|
|
584
675
|
export declare function searchReferences(query: string, source: Source$2, options?: ResolveOptions): ReferenceSearch;
|
|
@@ -586,6 +677,14 @@ export declare function searchReferences(query: string, source: Source$2, option
|
|
|
586
677
|
//#region src/references/reference-interface.d.ts
|
|
587
678
|
/** `one`: the implementation is named `<id>`. `many`: each is named `<id>.<key>`. */
|
|
588
679
|
type InterfaceCardinality = 'one' | 'many';
|
|
680
|
+
/** One section an implementation holds, as the interface lists it (R63, C7). Heading text is API. */
|
|
681
|
+
type InterfaceSection = {
|
|
682
|
+
heading: string;
|
|
683
|
+
/** A required section left out or marked `**Unsupported.**` fails the `required` check (R64). */
|
|
684
|
+
required: boolean;
|
|
685
|
+
/** One line saying what it holds: an implementation's stub states it (R28). It is never checked. */
|
|
686
|
+
holds?: string;
|
|
687
|
+
};
|
|
589
688
|
/** The machine-readable part of an interface document, read from its `interface:` frontmatter. */
|
|
590
689
|
type ReferenceInterface = {
|
|
591
690
|
id: string;
|
|
@@ -593,15 +692,16 @@ type ReferenceInterface = {
|
|
|
593
692
|
version: number;
|
|
594
693
|
/** The versions the owner's consumers accept; `[version]` when the document names none. */
|
|
595
694
|
versions: number[];
|
|
596
|
-
/** The implementation's top-level sections, in order.
|
|
597
|
-
sections:
|
|
695
|
+
/** The implementation's top-level sections, in order. */
|
|
696
|
+
sections: InterfaceSection[];
|
|
598
697
|
};
|
|
599
698
|
/** One `implements:` value, `<id>@<version>`. */
|
|
600
699
|
type ImplementsEntry = {
|
|
601
700
|
id: string;
|
|
602
701
|
version: number;
|
|
603
702
|
};
|
|
604
|
-
|
|
703
|
+
/** The checks `check` runs, each named in kebab-case (UC6). */
|
|
704
|
+
type InterfaceCheck = 'interface-found' | 'version' | 'name' | 'order' | 'required' | 'interface' | 'compose';
|
|
605
705
|
type InterfaceCheckFailure = {
|
|
606
706
|
check: InterfaceCheck;
|
|
607
707
|
/** The interface id the failure is about, when the document names one. */
|
|
@@ -613,7 +713,7 @@ type InterfaceCheckFailure = {
|
|
|
613
713
|
type ReferenceCheckKind = 'interface' | 'implementation' | 'none';
|
|
614
714
|
/** A failed check, named by the check; a name not `found` fails with its status code. */
|
|
615
715
|
type ReferenceCheckFailure = {
|
|
616
|
-
check: InterfaceCheck |
|
|
716
|
+
check: InterfaceCheck | ReferenceStatusCode;
|
|
617
717
|
/** The interface id the failure is about, when the document names one. */
|
|
618
718
|
interface?: string;
|
|
619
719
|
message: string;
|
|
@@ -621,35 +721,229 @@ type ReferenceCheckFailure = {
|
|
|
621
721
|
type ReferenceCheckEntry = {
|
|
622
722
|
name: string;
|
|
623
723
|
kind: ReferenceCheckKind;
|
|
624
|
-
/**
|
|
724
|
+
/**
|
|
725
|
+
* `passed` and `failed` are about the composed document; the others mean none was composed. A name
|
|
726
|
+
* a `remove` turned off is `missing` with no failures: it is off on purpose (R117).
|
|
727
|
+
*/
|
|
625
728
|
status: 'passed' | 'failed' | 'missing' | 'ambiguous' | 'invalid';
|
|
729
|
+
/** Empty when the entry passes. */
|
|
626
730
|
failures: ReferenceCheckFailure[];
|
|
627
|
-
/** For an implementation: the listed sections it marks `**Unsupported.**` or leaves out. */
|
|
731
|
+
/** For an implementation: the optional listed sections it marks `**Unsupported.**` or leaves out. */
|
|
628
732
|
unsupported: string[];
|
|
733
|
+
/**
|
|
734
|
+
* What is passed on and never fails a check: a warning composing raised that depends on what is
|
|
735
|
+
* installed or chosen (UC6.8), every warning a project section raised (R118), an interface's older
|
|
736
|
+
* id (R96), a moved base (R86), a hidden file (R112).
|
|
737
|
+
*/
|
|
738
|
+
warnings: ReferenceWarning[];
|
|
629
739
|
/** Checked as this skill loads the name, its default joined. */
|
|
630
740
|
loadedBy?: string;
|
|
631
741
|
};
|
|
632
742
|
type CheckOptions = ResolveOptions & {
|
|
633
|
-
/** The references to check; every
|
|
743
|
+
/** The references to check; every name found when omitted. */
|
|
634
744
|
names?: readonly string[] | undefined;
|
|
635
745
|
};
|
|
636
746
|
type Source$1 = ReferenceLayers | readonly ReferenceLayer[];
|
|
637
747
|
/**
|
|
638
|
-
* Checks each named reference, or, with no names, every
|
|
639
|
-
* A name several plugins hold is also checked as each `<plugin>/<name>`, so
|
|
640
|
-
* result, and each skill's default as its skill loads it.
|
|
748
|
+
* Checks each named reference, or, with no names, every name found, reporting every warning `load`
|
|
749
|
+
* raises for each (R116). A name several plugins hold is also checked as each `<plugin>/<name>`, so
|
|
750
|
+
* each author sees their own result, and each skill's default as its skill loads it. Beside what
|
|
751
|
+
* `load` raises, a hidden `repo`, `user`, or project-section file (J2, R112) and a plugin's or
|
|
752
|
+
* default's file whose base moved (R86) are passed on. A warning never fails a check.
|
|
641
753
|
*/
|
|
642
754
|
export declare function checkReferences(source: Source$1, options?: CheckOptions): ReferenceCheckEntry[];
|
|
643
755
|
//#endregion
|
|
756
|
+
//#region src/references/reference-write-target.d.ts
|
|
757
|
+
/**
|
|
758
|
+
* Where a write lands: the repo or user tier, a folder's project section, or a plugin's or a skill's
|
|
759
|
+
* source folder in the repository.
|
|
760
|
+
*/
|
|
761
|
+
type WriteScope = 'repo' | 'user' | 'project' | 'plugin' | 'default';
|
|
762
|
+
//#endregion
|
|
763
|
+
//#region src/references/reference-base.d.ts
|
|
764
|
+
/** What the generator reads for a target (R84): the interface's stub when one is named, then the main document. */
|
|
765
|
+
type GeneratorBase = {
|
|
766
|
+
/** The stub, then the main document built for the target; empty when neither is there. */
|
|
767
|
+
content: string;
|
|
768
|
+
/** For a folder target: the project sections of the folders above it, then the package plugins' for its own, in path order. */
|
|
769
|
+
projectSections: ResolvedProjectSection[];
|
|
770
|
+
/** The interface's stub, when one is named. */
|
|
771
|
+
stub?: string;
|
|
772
|
+
/** The main document built for the target, which a request records the sources of. */
|
|
773
|
+
resolved: ResolvedReference;
|
|
774
|
+
};
|
|
775
|
+
//#endregion
|
|
776
|
+
//#region src/references/reference-write.d.ts
|
|
777
|
+
type CreateResult = {
|
|
778
|
+
name: string;
|
|
779
|
+
scope: WriteScope;
|
|
780
|
+
path: string;
|
|
781
|
+
/** A project section's folder, relative to the root. */
|
|
782
|
+
folder?: string;
|
|
783
|
+
content: string;
|
|
784
|
+
dryRun: boolean;
|
|
785
|
+
/** Things to know that are not faults, such as a missing `description`. */
|
|
786
|
+
hints: string[];
|
|
787
|
+
/** Faults that did not stop the write, such as a contribution above that hides the file (R26). */
|
|
788
|
+
warnings: ReferenceWarning[];
|
|
789
|
+
/** The name resolved again after the write, when the file is a layer the stack reads or a project section. */
|
|
790
|
+
after?: ResolvedReference;
|
|
791
|
+
};
|
|
792
|
+
type DeleteResult = {
|
|
793
|
+
name: string;
|
|
794
|
+
scope: WriteScope;
|
|
795
|
+
/** The file deleted, or the one looked for when there was none. */
|
|
796
|
+
path: string;
|
|
797
|
+
/** A project section's folder, relative to the root. */
|
|
798
|
+
folder?: string;
|
|
799
|
+
/** The metadata file (K31) that went with a non-Markdown file (R95). */
|
|
800
|
+
metadataFile?: string;
|
|
801
|
+
dryRun: boolean;
|
|
802
|
+
/** The file held a selection (`extends`), which went with it. */
|
|
803
|
+
selection?: string[];
|
|
804
|
+
/** Set on a no-op: no file there to delete. */
|
|
805
|
+
code?: 'no-file';
|
|
806
|
+
/** What the notice says, for a person. */
|
|
807
|
+
message?: string;
|
|
808
|
+
/** What answers the name once the file is gone. */
|
|
809
|
+
after: ResolvedReference;
|
|
810
|
+
};
|
|
811
|
+
//#endregion
|
|
812
|
+
//#region src/references/write-reference.d.ts
|
|
813
|
+
/** Where a write goes; a folder is relative to `cwd`. Pass at most one of `scope`, `in`, `pluginFolder`, and `default`. */
|
|
814
|
+
type PlaceOptions = {
|
|
815
|
+
/** `repo` (default) or `user`. */
|
|
816
|
+
scope?: string | undefined;
|
|
817
|
+
/** A folder strictly below the root, which must exist and not be git-ignored: its project section. */
|
|
818
|
+
in?: string | undefined;
|
|
819
|
+
/** A plugin's source folder in the repository: its `references/<name>.md`. */
|
|
820
|
+
pluginFolder?: string | undefined;
|
|
821
|
+
/** A skill's source folder in the repository: its `references/<name>.default.md`. It also joins as the `default` tier. */
|
|
822
|
+
default?: string | undefined;
|
|
823
|
+
/** Report what would be written or deleted, and change nothing. */
|
|
824
|
+
dryRun?: boolean | undefined;
|
|
825
|
+
};
|
|
826
|
+
type CreateReferenceOptions = LoadReferenceOptions & PlaceOptions & {
|
|
827
|
+
/** `replace`, `patch` (default in the `repo` and `user` tiers), `combine`, or `remove`. */
|
|
828
|
+
merge?: string | undefined;
|
|
829
|
+
/** A file whose text is written as it is, frontmatter included. */
|
|
830
|
+
template?: string | undefined;
|
|
831
|
+
/** An interface id: its sections are written as `##` headings, each stubbed `**Unsupported.**`. */
|
|
832
|
+
implements?: string | undefined;
|
|
833
|
+
};
|
|
834
|
+
type DeleteReferenceOptions = LoadReferenceOptions & PlaceOptions;
|
|
835
|
+
/**
|
|
836
|
+
* Starts a contribution the way `reference create` does and returns its record: the path, the
|
|
837
|
+
* content, its warnings (such as `reference-hidden` for a file a contribution above hides, which is
|
|
838
|
+
* written all the same), and the name resolved after the write. A refused write throws
|
|
839
|
+
* `ReferenceError` with its code, marked `usage` for a wrong call.
|
|
840
|
+
*/
|
|
841
|
+
export declare function createReference(name: string, options: CreateReferenceOptions): Promise<CreateResult>;
|
|
842
|
+
/**
|
|
843
|
+
* Deletes the file answering a name at one place the way `reference delete` does, with a non-Markdown
|
|
844
|
+
* file's metadata file, and returns what answers the name afterwards. With no file there it is a
|
|
845
|
+
* no-op whose record carries the `no-file` code. A refused delete throws `ReferenceError`.
|
|
846
|
+
*/
|
|
847
|
+
export declare function deleteReference(name: string, options: DeleteReferenceOptions): Promise<DeleteResult>;
|
|
848
|
+
//#endregion
|
|
849
|
+
//#region src/references/reference-customize.d.ts
|
|
850
|
+
/**
|
|
851
|
+
* What `customize` did: printed the generator's input (`base`), wrote picks (`selection`), wrote a
|
|
852
|
+
* generated body (`generated`), or removed the picks (`cleared`).
|
|
853
|
+
*/
|
|
854
|
+
type CustomizeAction = 'base' | 'selection' | 'generated' | 'cleared';
|
|
855
|
+
type CustomizeResult = {
|
|
856
|
+
name: string;
|
|
857
|
+
scope: WriteScope;
|
|
858
|
+
action: CustomizeAction;
|
|
859
|
+
/** The file written, removed, or that would be: the Markdown file, a data file, or a metadata file holding picks. */
|
|
860
|
+
path: string;
|
|
861
|
+
/** A project section's folder, relative to the root. */
|
|
862
|
+
folder?: string;
|
|
863
|
+
/** The text written to `path`; none when the file was deleted. */
|
|
864
|
+
content?: string;
|
|
865
|
+
/** A non-Markdown name's metadata file (K31), which holds the generated record (R92). */
|
|
866
|
+
metadataFile?: string;
|
|
867
|
+
metadataContent?: string;
|
|
868
|
+
/** The picks written, as `extends` holds them. */
|
|
869
|
+
extends?: unknown[];
|
|
870
|
+
/** `--extends none` left the file with nothing in it, so it was deleted. */
|
|
871
|
+
deleted?: boolean;
|
|
872
|
+
/** Set on a no-op: `--extends none` with no selection there. */
|
|
873
|
+
code?: 'no-selection';
|
|
874
|
+
/** What the notice says, for a person. */
|
|
875
|
+
message?: string;
|
|
876
|
+
dryRun: boolean;
|
|
877
|
+
/** Things to know that are not faults, such as a generated body written against the old stack (R83). */
|
|
878
|
+
hints: string[];
|
|
879
|
+
/** Faults that did not stop the write: a contribution above that hides it (R26), or a managed `extends` deciding the stack (R109). */
|
|
880
|
+
warnings: ReferenceWarning[];
|
|
881
|
+
/** `base`: what the generator reads for the target. */
|
|
882
|
+
base?: GeneratorBase;
|
|
883
|
+
/** The name resolved again after the write. */
|
|
884
|
+
after?: ResolvedReference;
|
|
885
|
+
};
|
|
886
|
+
type CustomizeReferenceOptions = LoadReferenceOptions & Omit<PlaceOptions, 'pluginFolder'> & {
|
|
887
|
+
/** The picks, bottom first: each `<plugin>`, `<plugin>:<merge>`, or `default`; `['none']` removes them. */
|
|
888
|
+
extends?: readonly string[] | undefined;
|
|
889
|
+
/** A YAML file holding the whole `extends` list. */
|
|
890
|
+
extendsFile?: string | undefined;
|
|
891
|
+
/** The file holding the customizer's request; pass it with `body`. */
|
|
892
|
+
request?: string | undefined;
|
|
893
|
+
/** The file holding the body to write; pass it with `request`. */
|
|
894
|
+
body?: string | undefined;
|
|
895
|
+
/** How a generated body applies over what is below: `patch` (default), `combine`, `replace`, or `remove`. */
|
|
896
|
+
merge?: string | undefined;
|
|
897
|
+
/** An interface id: the body is a whole implementation of it. */
|
|
898
|
+
implements?: string | undefined;
|
|
899
|
+
/** Return the generator's input (R84) and write nothing. */
|
|
900
|
+
base?: boolean | undefined;
|
|
901
|
+
};
|
|
902
|
+
/**
|
|
903
|
+
* Customizes a name the way `reference customize` does and returns its record: what was written,
|
|
904
|
+
* its warnings (such as `reference-hidden`), and the name resolved after; with `base`, the
|
|
905
|
+
* generator's input. A refused customization throws `ReferenceError` with its code, marked `usage`
|
|
906
|
+
* for a wrong call.
|
|
907
|
+
*/
|
|
908
|
+
export declare function customizeReference(name: string, options: CustomizeReferenceOptions): Promise<CustomizeResult>;
|
|
909
|
+
//#endregion
|
|
910
|
+
//#region src/references/reference-error.d.ts
|
|
911
|
+
type ReferenceErrorOptions = {
|
|
912
|
+
/** Fields an agent can act on, such as the path refused. Each value a scalar or a list of scalars. */
|
|
913
|
+
details?: Record<string, string | number | boolean | null | readonly (string | number | boolean | null)[]> | undefined;
|
|
914
|
+
/** What to do about it, such as the command that fixes it. */
|
|
915
|
+
help?: string | readonly string[] | undefined;
|
|
916
|
+
};
|
|
917
|
+
/**
|
|
918
|
+
* A request a reference function cannot complete, or one called wrongly, thrown by a library
|
|
919
|
+
* function and by a write (R48). The `code` is stable and in `referenceCodes`; `usage` marks a wrong
|
|
920
|
+
* invocation, which a command exits 2 on, rather than a refusal, which it exits 1 on. A name that is
|
|
921
|
+
* not `found` is a status in its record, never this error.
|
|
922
|
+
*
|
|
923
|
+
* The package exports it as `ReferenceError` (C9); inside the source it keeps this name, so no module
|
|
924
|
+
* shadows the global `ReferenceError`.
|
|
925
|
+
*/
|
|
926
|
+
declare class ReferenceFailure extends Error {
|
|
927
|
+
readonly name = "ReferenceError";
|
|
928
|
+
readonly code: ReferenceCode;
|
|
929
|
+
readonly usage: boolean;
|
|
930
|
+
readonly details: NonNullable<ReferenceErrorOptions['details']>;
|
|
931
|
+
readonly help: string[];
|
|
932
|
+
constructor(code: ReferenceCode, message: string, { details, help }?: ReferenceErrorOptions);
|
|
933
|
+
}
|
|
934
|
+
//#endregion
|
|
644
935
|
//#region src/references/reference-implementations.d.ts
|
|
645
936
|
type ReferenceImplementation = {
|
|
646
|
-
/**
|
|
937
|
+
/**
|
|
938
|
+
* What a consumer loads: a plugin's implementation by its qualified name, `<plugin>/<name>`; a
|
|
939
|
+
* `repo` or `user` implementation of a `many` interface by its bare name (R35).
|
|
940
|
+
*/
|
|
647
941
|
pin: string;
|
|
648
942
|
description: string;
|
|
649
|
-
/** The listed sections it marks `**Unsupported.**` or leaves out, in the interface's order. */
|
|
943
|
+
/** The optional listed sections it marks `**Unsupported.**` or leaves out, in the interface's order. */
|
|
650
944
|
unsupported: string[];
|
|
651
945
|
name: string;
|
|
652
|
-
/**
|
|
946
|
+
/** `plugin`, or the `repo` or `user` tier of a bare-name implementation. */
|
|
653
947
|
tier: ReferenceTier;
|
|
654
948
|
version: number;
|
|
655
949
|
};
|
|
@@ -673,45 +967,16 @@ type ImplementationsOptions = ResolveOptions & {
|
|
|
673
967
|
type Source = ReferenceLayers | readonly ReferenceLayer[];
|
|
674
968
|
/**
|
|
675
969
|
* The implementations of interface `id` a consumer may load, each checked as `check` would on its
|
|
676
|
-
* composed document, and every candidate left out with why. A candidate is a name in the
|
|
677
|
-
* namespace (`<id>` or `<id>.<key>`) or a reference that declares `implements: <id>@<n
|
|
678
|
-
*
|
|
970
|
+
* composed document, and every candidate left out with why (R35). A candidate is a name in the
|
|
971
|
+
* interface's namespace (`<id>` or `<id>.<key>`) or a reference that declares `implements: <id>@<n>`:
|
|
972
|
+
* a plugin's, pinned by its qualified name, or, for a `many` interface, a `repo` or `user` one,
|
|
973
|
+
* pinned by its bare name. When a `repo` or `user` implementation answers the bare name, a plugin's
|
|
974
|
+
* of that name is left out (C1, J3), since loading the bare name returns the other. Plugins holding
|
|
975
|
+
* a name no `extends` orders are all left out until a customizer picks one (R87). A skill's default
|
|
976
|
+
* is never listed: it has no qualified name to pin. An unknown interface throws.
|
|
679
977
|
*/
|
|
680
978
|
export declare function referenceImplementations(id: string, source: Source, options?: ImplementationsOptions): ReferenceImplementations;
|
|
681
979
|
//#endregion
|
|
682
|
-
//#region src/references/reference-where.d.ts
|
|
683
|
-
/** A file a customization or a selection of the name is written to. */
|
|
684
|
-
type ReferenceWherePlace = {
|
|
685
|
-
scope: 'project' | 'user';
|
|
686
|
-
/** The project path is relative to the root; the user path is shown as the command displays it. */
|
|
687
|
-
path: string;
|
|
688
|
-
reaches: string;
|
|
689
|
-
/** `used`, `shadowed by ...`, or `not used (...)` when the file exists; `empty` when it does not. */
|
|
690
|
-
status: string;
|
|
691
|
-
/** The heading paths of the document below it, which a section operation can target. */
|
|
692
|
-
sections: string[];
|
|
693
|
-
};
|
|
694
|
-
type ReferenceWhereReport = {
|
|
695
|
-
name: string;
|
|
696
|
-
status: ReferenceStatus;
|
|
697
|
-
places: ReferenceWherePlace[];
|
|
698
|
-
/** When `ambiguous`: the options a selection written to a place chooses between. */
|
|
699
|
-
options?: string[];
|
|
700
|
-
/** Every layer checked, highest first; a plugin's or a default contribution is read-only. */
|
|
701
|
-
layers: ReferenceTraceLayer[];
|
|
702
|
-
warnings: ReferenceWarning[];
|
|
703
|
-
};
|
|
704
|
-
type WhereOptions = {
|
|
705
|
-
/** Absolute; a project write goes to its `.agents/references/`, and a project path is shown relative to it. */
|
|
706
|
-
root: string;
|
|
707
|
-
/** How a path outside the project is shown, such as with the home directory collapsed to `~`. */
|
|
708
|
-
display?: ((path: string) => string) | undefined;
|
|
709
|
-
/** An assets call: the project write goes to `.agents/assets/`. */
|
|
710
|
-
assets?: boolean | undefined;
|
|
711
|
-
};
|
|
712
|
-
/** The project and user files a customization of `name` is written to, with the document below each. */
|
|
713
|
-
export declare function whereReference(input: string | ReferenceName, source: ReferenceLayers | readonly ReferenceLayer[], { root, display, assets }: WhereOptions): ReferenceWhereReport;
|
|
714
|
-
//#endregion
|
|
715
980
|
//#region src/skills/harness-skill-folders.d.ts
|
|
716
981
|
/**
|
|
717
982
|
* The harnesses whose skill folders are verified: project, user, machine-wide admin, and plugin
|
|
@@ -825,4 +1090,4 @@ interface SkillsDirectories {
|
|
|
825
1090
|
*/
|
|
826
1091
|
export declare function skillsDirectories(harness: HarnessId): SkillsDirectories | undefined;
|
|
827
1092
|
//#endregion
|
|
828
|
-
export { type AmbiguousCause, type BaseRef, type CheckOptions, type CheckPluginDependenciesOptions, type CheckedDependency, type Classification, type ClassifyInput, type Collision, type DependencyState, type DetectHarnessOptions, type EnabledPluginSource, type EnabledPluginsOptions, type EnabledPluginsResult, type ExcludedImplementation, type ExtendsStep, type FoundSkill, type HarnessDetectionResult, type HarnessEnvironment, type HarnessEvidence, type HarnessId, type HeadlessCommand, type HeadlessCommandOptions, type HeadlessExitCode, type HeadlessInvocation, type HeadlessMode, type HeadlessOutputFormat, type HeadlessPermission, type HeadlessTranscript, type HeadlessUnavailable, type HeadlessUsage, type ImplementationsOptions, type ImplementsEntry, type InstalledPlugin, type InstalledPluginSource, type InstalledPluginsResult, type InterfaceCardinality, type InterfaceCheck, type InterfaceCheckFailure, type InvalidEntry, type ListOptions, type LoadReferenceOptions, type ManagedPolicyKind, type ManagedPolicyLocation, type ManagedPolicyOptions, type MatchKind, type MergeOperation, type OperationSource, type Outcome, type ParsedHistory, type PartResult, type Platform, type PluginDependenciesRead, type PluginDependency, type PluginDependencyCheck, type PluginEnablement, type PluginScope, type PluginSkill, type PluginStorage, type PluginStorageKind, type PluginStorageLocation, type Reason, type ReferenceCheckEntry, type ReferenceCheckFailure, type ReferenceCheckKind, type ReferenceCode, type ReferenceImplementation, type ReferenceImplementations, type ReferenceInterface, type ReferenceLayer, type ReferenceLayerOptions, type ReferenceLayers, type ReferenceListLayerRow, type ReferenceListRow, type ReferenceListing, type ReferenceName, type ReferencePlugin, type ReferenceSearch, type ReferenceStatus, type ReferenceTier, type ReferenceTrace, type ReferenceTraceContribution, type ReferenceTraceLayer, type ReferenceTraceSection, type ReferenceWarning, type ReferenceWarningCode, type
|
|
1093
|
+
export { type AmbiguousCause, type BaseRef, type CheckOptions, type CheckPluginDependenciesOptions, type CheckedDependency, type Classification, type ClassifyInput, type Collision, type CreateReferenceOptions, type CreateResult, type CustomizeAction, type CustomizeReferenceOptions, type CustomizeResult, type DeleteReferenceOptions, type DeleteResult, type DependencyState, type DetectHarnessOptions, type EnabledPluginSource, type EnabledPluginsOptions, type EnabledPluginsResult, type ExcludedImplementation, type ExtendsStep, type FoundSkill, type GeneratedRecord, type GeneratorBase, type HarnessDetectionResult, type HarnessEnvironment, type HarnessEvidence, type HarnessId, type HeadlessCommand, type HeadlessCommandOptions, type HeadlessExitCode, type HeadlessInvocation, type HeadlessMode, type HeadlessOutputFormat, type HeadlessPermission, type HeadlessTranscript, type HeadlessUnavailable, type HeadlessUsage, type ImplementationsOptions, type ImplementsEntry, type InstalledPlugin, type InstalledPluginSource, type InstalledPluginsResult, type InterfaceCardinality, type InterfaceCheck, type InterfaceCheckFailure, type InterfaceSection, type InvalidEntry, type ListOptions, type LoadAssetOptions, type LoadReferenceOptions, type ManagedPolicyKind, type ManagedPolicyLocation, type ManagedPolicyOptions, type MatchKind, type MergeOperation, type OperationSource, type Outcome, type ParsedHistory, type PartResult, type Platform, type PluginDependenciesRead, type PluginDependency, type PluginDependencyCheck, type PluginEnablement, type PluginOrigin, type PluginScope, type PluginSkill, type PluginStorage, type PluginStorageKind, type PluginStorageLocation, type ProjectFolder, type ProjectFolderCache, type ProjectFolders, type Reason, type ReferenceCheckEntry, type ReferenceCheckFailure, type ReferenceCheckKind, type ReferenceCode, type ReferenceCodeKind, ReferenceFailure as ReferenceError, type ReferenceErrorCode, type ReferenceErrorOptions, type ReferenceImplementation, type ReferenceImplementations, type ReferenceInterface, type ReferenceLayer, type ReferenceLayerOptions, type ReferenceLayers, type ReferenceListLayerRow, type ReferenceListRow, type ReferenceListRowKind, type ReferenceListing, type ReferenceName, type ReferenceNoticeCode, type ReferencePlugin, type ReferenceSearch, type ReferenceSource, type ReferenceSourcePlugin, type ReferenceStatus, type ReferenceStatusCode, type ReferenceTier, type ReferenceTrace, type ReferenceTraceContribution, type ReferenceTraceLayer, type ReferenceTraceProjectSection, type ReferenceTraceSection, type ReferenceTraceSource, type ReferenceWarning, type ReferenceWarningCode, type ReferenceWhereFile, type ReferenceWhereReport, type ResolveOptions, type ResolvedAsset, type ResolvedProjectSection, type ResolvedReference, type RetiredWording, type SearchMatch, type SectionSource, type SkillDefaults, type SkillFolderOptions, type SkillInvocation, type SkillsDirectories, type WhereOptions, type WriteScope, defaultLayer, harnessIds, parseReferenceName, referenceCodeExit, referenceCodes, referenceLayers, referenceNames, repoReferencesDir, resolveReference, skillName, skillsIn, userReferencesDir, whereReference };
|
package/dist/index.js
CHANGED
|
@@ -1,32 +1,19 @@
|
|
|
1
|
-
import { A as
|
|
1
|
+
import { $ as readText, A as harnessSkillFolders, C as referenceLayers, D as referenceCodeExit, E as ReferenceFailure, F as resolveAsset, G as detectHarness, H as enabledPlugins, J as pluginManifestName, K as skillName, M as skillFoldersVerified, N as skillsDirectories, O as referenceCodes, Q as isRecord, R as assetLayers, T as userReferencesDir, U as pluginStorage, V as installedPlugins, W as managedPolicyLocations, X as declaredDependencies, Y as pluginManifestPaths, Z as packageDir, _ as referenceNames, a as createReference, b as requireName, et as stripJsonComments, f as checkReferences, g as searchReferences, h as listReferences, i as customizeReference, j as pluginSkillFolders, k as adminSkillFolders, n as referenceImplementations, o as deleteReference, q as skillsIn, t as whereReference, v as resolveReference, w as repoReferencesDir, x as defaultLayer, y as parseReferenceName } from "./reference-where-CVmGFOwR.js";
|
|
2
2
|
import { homedir } from "node:os";
|
|
3
3
|
import { join } from "node:path";
|
|
4
|
-
//#region src/references/load-reference.ts
|
|
5
|
-
/**
|
|
6
|
-
* Resolves one reference for `root` the way `reference show` does, returning the full record: every
|
|
7
|
-
* field `show` prints with `--metadata` and `--trace`. A name that is not a reference name comes back
|
|
8
|
-
* `invalid`, and one no contribution answers `missing`; neither throws.
|
|
9
|
-
*/
|
|
10
|
-
async function loadReference(name, options) {
|
|
11
|
-
const layers = await referenceLayers({
|
|
12
|
-
...options,
|
|
13
|
-
home: options.home ?? homedir(),
|
|
14
|
-
platform: options.platform ?? process.platform
|
|
15
|
-
});
|
|
16
|
-
return resolveReference(name, layers);
|
|
17
|
-
}
|
|
18
|
-
//#endregion
|
|
19
4
|
//#region src/assets/load-asset.ts
|
|
20
5
|
/**
|
|
21
|
-
* Resolves one asset by name the way `asset load` does
|
|
22
|
-
*
|
|
23
|
-
*
|
|
6
|
+
* Resolves one asset by name the way `asset load` does, reading `assets/` folders through the tiers.
|
|
7
|
+
* A data file answers whole from the highest tier holding the name; the skill's own
|
|
8
|
+
* `assets/<name>.<ext>` (`defaultSkill`) is the lowest.
|
|
24
9
|
*/
|
|
25
10
|
async function loadAsset(name, options) {
|
|
26
|
-
|
|
11
|
+
const layers = await assetLayers({
|
|
27
12
|
...options,
|
|
28
|
-
|
|
13
|
+
home: options.home ?? homedir(),
|
|
14
|
+
platform: options.platform ?? process.platform
|
|
29
15
|
});
|
|
16
|
+
return resolveAsset(name, layers);
|
|
30
17
|
}
|
|
31
18
|
//#endregion
|
|
32
19
|
//#region src/plugins/plugin-dependencies.ts
|
|
@@ -1169,6 +1156,23 @@ function assemble(found, foundParts, offeredParts, merged, results) {
|
|
|
1169
1156
|
return documentOrder(foundParts, offeredParts, results).filter((key) => results.get(key).outcome !== "up-to-date" || foundParts.some((p) => p.key === key)).map((key) => merged.get(key) ?? (foundParts.some((p) => p.key === key) ? raw.get(key) : void 0)).filter((piece) => piece !== void 0 && piece !== "").join("\n\n") + (found.endsWith("\n") ? "\n" : "");
|
|
1170
1157
|
}
|
|
1171
1158
|
//#endregion
|
|
1159
|
+
//#region src/references/load-reference.ts
|
|
1160
|
+
/**
|
|
1161
|
+
* Resolves one reference for the root the way `reference load` does, returning the full record: every
|
|
1162
|
+
* field `load` prints with `--metadata` and `--trace`. A name that is not a reference name comes back
|
|
1163
|
+
* `invalid`, and one no contribution answers `missing`; neither throws. An empty name throws
|
|
1164
|
+
* `ReferenceFailure` with `name-missing`, and a `root` that does not exist with `root-missing`.
|
|
1165
|
+
*/
|
|
1166
|
+
async function loadReference(name, options) {
|
|
1167
|
+
requireName(name);
|
|
1168
|
+
const layers = await referenceLayers({
|
|
1169
|
+
...options,
|
|
1170
|
+
home: options.home ?? homedir(),
|
|
1171
|
+
platform: options.platform ?? process.platform
|
|
1172
|
+
});
|
|
1173
|
+
return resolveReference(name, layers);
|
|
1174
|
+
}
|
|
1175
|
+
//#endregion
|
|
1172
1176
|
//#region src/skills/skill-invocation.ts
|
|
1173
1177
|
/**
|
|
1174
1178
|
* How a user invokes a plugin's skill in a harness.
|
|
@@ -1244,4 +1248,4 @@ function skillInvocation(harness, { plugin, skill }) {
|
|
|
1244
1248
|
}
|
|
1245
1249
|
}
|
|
1246
1250
|
//#endregion
|
|
1247
|
-
export { ProseUpdateError, adminSkillFolders, checkPluginDependencies, checkReferences, classify, declaredDependencies, declaredPluginDependencies, defaultLayer, detectHarness, enabledPlugins, harnessIds, harnessSkillFolders, headlessCommand, headlessInvocation, installedPlugins, listReferences, loadAsset, loadReference, managedPolicyLocations, packageDir, parseHistory, parseReferenceName, pluginManifestName, pluginManifestPaths, pluginSkillFolders, pluginStorage,
|
|
1251
|
+
export { ProseUpdateError, ReferenceFailure as ReferenceError, adminSkillFolders, checkPluginDependencies, checkReferences, classify, createReference, customizeReference, declaredDependencies, declaredPluginDependencies, defaultLayer, deleteReference, detectHarness, enabledPlugins, harnessIds, harnessSkillFolders, headlessCommand, headlessInvocation, installedPlugins, listReferences, loadAsset, loadReference, managedPolicyLocations, packageDir, parseHistory, parseReferenceName, pluginManifestName, pluginManifestPaths, pluginSkillFolders, pluginStorage, readPluginDependencies, referenceCodeExit, referenceCodes, referenceImplementations, referenceLayers, referenceNames, repoReferencesDir, resolveReference, retire, searchReferences, skillFoldersVerified, skillInvocation, skillName, skillsDirectories, skillsIn, supportsPluginDependencies, userReferencesDir, whereReference };
|