@agentled/cli 0.1.6 → 0.5.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 +136 -0
- package/dist/builtin-tools-catalog.d.ts +37 -0
- package/dist/builtin-tools-catalog.js +96 -0
- package/dist/builtin-tools-catalog.js.map +1 -0
- package/dist/commands/auth.js +30 -0
- package/dist/commands/auth.js.map +1 -1
- package/dist/commands/examples.d.ts +15 -0
- package/dist/commands/examples.js +100 -0
- package/dist/commands/examples.js.map +1 -0
- package/dist/commands/scaffold.d.ts +14 -0
- package/dist/commands/scaffold.js +103 -0
- package/dist/commands/scaffold.js.map +1 -0
- package/dist/commands/schema.d.ts +10 -0
- package/dist/commands/schema.js +107 -0
- package/dist/commands/schema.js.map +1 -0
- package/dist/commands/skills.d.ts +9 -0
- package/dist/commands/skills.js +94 -0
- package/dist/commands/skills.js.map +1 -0
- package/dist/commands/tools.d.ts +10 -0
- package/dist/commands/tools.js +53 -0
- package/dist/commands/tools.js.map +1 -0
- package/dist/commands/workflows.js +227 -9
- package/dist/commands/workflows.js.map +1 -1
- package/dist/context-schema.d.ts +37 -0
- package/dist/context-schema.js +108 -0
- package/dist/context-schema.js.map +1 -0
- package/dist/index.js +8 -0
- package/dist/index.js.map +1 -1
- package/dist/utils/preflight.d.ts +25 -0
- package/dist/utils/preflight.js +293 -0
- package/dist/utils/preflight.js.map +1 -0
- package/dist/utils/skills.d.ts +49 -0
- package/dist/utils/skills.js +214 -0
- package/dist/utils/skills.js.map +1 -0
- package/package.json +4 -1
- package/patterns/v1/00-why-agentic-ops.md +107 -0
- package/patterns/v1/01-trigger-design.md +107 -0
- package/patterns/v1/02-dedup-gates.md +135 -0
- package/patterns/v1/03-credit-efficiency.md +130 -0
- package/patterns/v1/04-loop-patterns.md +147 -0
- package/patterns/v1/05-child-workflow-contracts.md +151 -0
- package/patterns/v1/06-conditional-routing.md +151 -0
- package/patterns/v1/07-error-handling.md +157 -0
- package/patterns/v1/08-composed-email-approval.md +130 -0
- package/patterns/v1/09-reports-and-knowledge-storage.md +166 -0
- package/scaffolds/README.md +62 -0
- package/scaffolds/ai-with-tools.json +49 -0
- package/scaffolds/email-polling-dedup.json +71 -0
- package/scaffolds/extract-threshold-alert.json +131 -0
- package/scaffolds/lead-scoring-kg.json +84 -0
- package/scaffolds/list-match-email.json +131 -0
- package/scaffolds/minimal.json +20 -0
- package/skills/agentled/SKILL.md +573 -0
package/README.md
CHANGED
|
@@ -47,6 +47,142 @@ AGENTLED_WORKSPACE=inovexus agentled workflows list
|
|
|
47
47
|
agentled auth remove bestseo4u
|
|
48
48
|
```
|
|
49
49
|
|
|
50
|
+
### Claude Code skill auto-install (v0.2+)
|
|
51
|
+
|
|
52
|
+
On first successful login, `agentled auth login` installs the bundled Agentled
|
|
53
|
+
skill into `~/.claude/skills/agentled/` so Claude Code picks up pipeline shape
|
|
54
|
+
hints (valid step types, common invalid patterns) automatically. Returning
|
|
55
|
+
users see a line showing the installed version and whether a newer one is
|
|
56
|
+
available.
|
|
57
|
+
|
|
58
|
+
Skip the auto-install with `--skip-skills`:
|
|
59
|
+
|
|
60
|
+
```bash
|
|
61
|
+
agentled auth login --skip-skills
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
Manage the skill manually with the `agentled skills` subcommands:
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
# Fresh install to ~/.claude/skills/ (or --project for the current project)
|
|
68
|
+
agentled skills install
|
|
69
|
+
|
|
70
|
+
# Update to the version bundled with this CLI release
|
|
71
|
+
agentled skills update
|
|
72
|
+
|
|
73
|
+
# Show bundled vs installed versions
|
|
74
|
+
agentled skills status
|
|
75
|
+
|
|
76
|
+
# Overwrite hand-edited skills (advanced)
|
|
77
|
+
agentled skills install --force
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
## Auto-validation on create / update
|
|
81
|
+
|
|
82
|
+
`agentled workflows create` and `agentled workflows update` call
|
|
83
|
+
`validate_workflow` immediately after the API returns 201/200. If validation
|
|
84
|
+
finds errors, the command:
|
|
85
|
+
|
|
86
|
+
- prints a structured error report (stepId, message, code, suggested fix)
|
|
87
|
+
- exits with status code **`2`** (distinct from `1` = CLI/network error)
|
|
88
|
+
- tells you how to re-check, fix, or delete the broken workflow
|
|
89
|
+
|
|
90
|
+
Pass `--skip-validate` to restore the legacy raw-create behavior (useful for
|
|
91
|
+
CI pipelines that run their own validation logic).
|
|
92
|
+
|
|
93
|
+
```bash
|
|
94
|
+
# Create + validate (default)
|
|
95
|
+
agentled workflows create --file pipeline.json
|
|
96
|
+
|
|
97
|
+
# Create without validation
|
|
98
|
+
agentled workflows create --file pipeline.json --skip-validate
|
|
99
|
+
|
|
100
|
+
# Update + validate (default)
|
|
101
|
+
agentled workflows update <id> --file updates.json
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
## Schema and best-practice patterns (v0.3+)
|
|
105
|
+
|
|
106
|
+
Before writing pipeline JSON, look up the canonical field schema and the
|
|
107
|
+
matching agentic-ops pattern. These commands avoid the "agent invents step
|
|
108
|
+
types" failure mode that produces 201-but-broken workflows.
|
|
109
|
+
|
|
110
|
+
```bash
|
|
111
|
+
# Full canonical PipelineStep field schema
|
|
112
|
+
agentled schema
|
|
113
|
+
|
|
114
|
+
# Fields applicable to an aiAction step
|
|
115
|
+
agentled schema --step-type aiAction
|
|
116
|
+
|
|
117
|
+
# Human-readable instead of JSON
|
|
118
|
+
agentled schema --format table
|
|
119
|
+
|
|
120
|
+
# List the 8 bundled workflow patterns
|
|
121
|
+
agentled examples
|
|
122
|
+
|
|
123
|
+
# Print one pattern (by slug, number, or keyword)
|
|
124
|
+
agentled examples trigger-design
|
|
125
|
+
agentled examples 04 # loops
|
|
126
|
+
agentled examples dedup
|
|
127
|
+
|
|
128
|
+
# Summary + link to the canonical public repo
|
|
129
|
+
agentled best-practices
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
The patterns are maintained publicly at
|
|
133
|
+
[github.com/agentled/agentic-ops](https://github.com/agentled/agentic-ops).
|
|
134
|
+
The CLI ships a byte-identical mirror for offline reading; a CI drift test
|
|
135
|
+
in this repo keeps them in sync.
|
|
136
|
+
|
|
137
|
+
## Scaffolds and preflight (v0.4+)
|
|
138
|
+
|
|
139
|
+
`agentled workflows scaffold` and `agentled workflows validate --file` let
|
|
140
|
+
you start from a known-good template and check your draft locally before
|
|
141
|
+
any API call. Both avoid the "201 Created but silently broken" failure mode.
|
|
142
|
+
|
|
143
|
+
```bash
|
|
144
|
+
# List the bundled scaffolds
|
|
145
|
+
agentled workflows scaffold --list
|
|
146
|
+
|
|
147
|
+
# Print a scaffold to stdout
|
|
148
|
+
agentled workflows scaffold lead-scoring-kg
|
|
149
|
+
|
|
150
|
+
# Write a scaffold to a file to start editing from
|
|
151
|
+
agentled workflows scaffold list-match-email --out pipeline.json
|
|
152
|
+
|
|
153
|
+
# Client-side preflight: no API call, catches invalid step types, stripped
|
|
154
|
+
# root fields (prompt / responseStructure / listKey / appId), dangling
|
|
155
|
+
# next.stepId, missing required sub-object fields, duplicate step IDs.
|
|
156
|
+
# Exits 2 on error so CI can gate on it.
|
|
157
|
+
agentled workflows validate --file pipeline.json
|
|
158
|
+
|
|
159
|
+
# Server-side validate of a stored workflow (unchanged)
|
|
160
|
+
agentled workflows validate <workflowId>
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
Scaffolds are **pattern shapes, not domain templates** — domain-agnostic
|
|
164
|
+
placeholders (`candidate`, `metric_a`, `entity_id`) so they adapt to any
|
|
165
|
+
vertical. See `packages/cli/scaffolds/README.md` for the contract and how
|
|
166
|
+
to add a new one.
|
|
167
|
+
|
|
168
|
+
| Name | Patterns | Shape |
|
|
169
|
+
|------|----------|-------|
|
|
170
|
+
| `minimal` | — | trigger → milestone |
|
|
171
|
+
| `email-polling-dedup` | 02 + 13 | schedule → fetch emails (label dedup) → loop process → add label |
|
|
172
|
+
| `lead-scoring-kg` | 04 + 09 | trigger → kg.read-list → AI scoring loop → knowledgeSync |
|
|
173
|
+
| `list-match-email` | 08 | trigger → kg.read-list → AI match → composed email (approval gate) → knowledgeSync |
|
|
174
|
+
| `extract-threshold-alert` | 06 + 09 | trigger → AI extract → threshold check → external update → conditional Slack alert → knowledgeSync |
|
|
175
|
+
|
|
176
|
+
Each bundled scaffold passes `workflows validate --file` out of the box.
|
|
177
|
+
|
|
178
|
+
### Bring your own scaffolds
|
|
179
|
+
|
|
180
|
+
Drop JSON files in `~/.agentled/scaffolds/` or set `AGENTLED_SCAFFOLDS_DIR`
|
|
181
|
+
to point at a directory. Local scaffolds appear with a `[local]` tag in
|
|
182
|
+
`scaffold --list`, and local slugs **shadow** bundled ones with the same
|
|
183
|
+
name — a team can override `list-match-email.json` without waiting on a
|
|
184
|
+
CLI release.
|
|
185
|
+
|
|
50
186
|
## Company profile commands
|
|
51
187
|
|
|
52
188
|
```bash
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Builtin tools catalog for `aiActionWithTools` steps.
|
|
3
|
+
*
|
|
4
|
+
* Canonical source: the `Tool.builtinType` union in
|
|
5
|
+
* `shared/types/pipeline/PipelineTypes.ts`. This file is the
|
|
6
|
+
* CLI-distributable mirror — drift is guarded by
|
|
7
|
+
* `agentled-mcp-server/__tests__/builtin-tools-catalog.test.ts`.
|
|
8
|
+
*
|
|
9
|
+
* When a new builtin is added to the runtime:
|
|
10
|
+
* 1. Extend the `Tool.builtinType` union in PipelineTypes.ts
|
|
11
|
+
* 2. Append the same value to this catalog with a description + config
|
|
12
|
+
* 3. The drift test enforces (1) ⊆ (2) and vice versa
|
|
13
|
+
*/
|
|
14
|
+
export interface BuiltinToolDoc {
|
|
15
|
+
/** Wire value — goes into `tools[].builtinType`. */
|
|
16
|
+
value: string;
|
|
17
|
+
/** One-line description of what the tool does at runtime. */
|
|
18
|
+
description: string;
|
|
19
|
+
/** Extra config keys the tool reads beyond `builtinType`. */
|
|
20
|
+
extraKeys?: string[];
|
|
21
|
+
/**
|
|
22
|
+
* Providers that surface this tool. `all` means any AI provider we support
|
|
23
|
+
* (via a shim if needed). `anthropic` / `openai` means the tool is a native
|
|
24
|
+
* tool for that provider and may be a no-op elsewhere.
|
|
25
|
+
*/
|
|
26
|
+
providers: Array<'all' | 'anthropic' | 'openai' | 'moonshot'>;
|
|
27
|
+
/** Typical credit cost per invocation (best-effort; see live registry for exact). */
|
|
28
|
+
typicalCreditsPerCall?: number;
|
|
29
|
+
/** Minimal JSON fragment for the `tools[]` array. */
|
|
30
|
+
example: Record<string, unknown>;
|
|
31
|
+
}
|
|
32
|
+
export declare const BUILTIN_TOOLS_CATALOG: BuiltinToolDoc[];
|
|
33
|
+
export declare const VALID_BUILTIN_TOOL_VALUES: Set<string>;
|
|
34
|
+
/**
|
|
35
|
+
* Heuristic "did you mean" for the most common invented / typo'd builtinType values.
|
|
36
|
+
*/
|
|
37
|
+
export declare function suggestBuiltinToolFix(invalid: string): string | undefined;
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Builtin tools catalog for `aiActionWithTools` steps.
|
|
3
|
+
*
|
|
4
|
+
* Canonical source: the `Tool.builtinType` union in
|
|
5
|
+
* `shared/types/pipeline/PipelineTypes.ts`. This file is the
|
|
6
|
+
* CLI-distributable mirror — drift is guarded by
|
|
7
|
+
* `agentled-mcp-server/__tests__/builtin-tools-catalog.test.ts`.
|
|
8
|
+
*
|
|
9
|
+
* When a new builtin is added to the runtime:
|
|
10
|
+
* 1. Extend the `Tool.builtinType` union in PipelineTypes.ts
|
|
11
|
+
* 2. Append the same value to this catalog with a description + config
|
|
12
|
+
* 3. The drift test enforces (1) ⊆ (2) and vice versa
|
|
13
|
+
*/
|
|
14
|
+
export const BUILTIN_TOOLS_CATALOG = [
|
|
15
|
+
{
|
|
16
|
+
value: 'web_search',
|
|
17
|
+
description: 'Search the web for fresh information. Returns ranked snippets with URLs.',
|
|
18
|
+
providers: ['all'],
|
|
19
|
+
typicalCreditsPerCall: 2,
|
|
20
|
+
example: { type: 'builtin', name: 'web_search', builtinType: 'web_search' },
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
value: 'fetch_website_content',
|
|
24
|
+
description: 'Fetch and extract readable content from a specific URL (companion to web_search).',
|
|
25
|
+
providers: ['all'],
|
|
26
|
+
typicalCreditsPerCall: 1,
|
|
27
|
+
example: { type: 'builtin', name: 'fetch_website_content', builtinType: 'fetch_website_content' },
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
value: 'file_search',
|
|
31
|
+
description: 'Search across files attached to the workspace / conversation.',
|
|
32
|
+
providers: ['openai'],
|
|
33
|
+
example: { type: 'builtin', name: 'file_search', builtinType: 'file_search' },
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
value: 'code_interpreter',
|
|
37
|
+
description: 'Run Python code in a sandbox. Useful for ad-hoc data crunching inside an AI step.',
|
|
38
|
+
providers: ['openai', 'anthropic'],
|
|
39
|
+
typicalCreditsPerCall: 3,
|
|
40
|
+
example: { type: 'builtin', name: 'code_interpreter', builtinType: 'code_interpreter' },
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
value: 'workspace_memory',
|
|
44
|
+
description: 'Recall/search/store persistent memories scoped to workspace or workflow. Memories ≥70 confidence auto-sync to the KG.',
|
|
45
|
+
providers: ['all'],
|
|
46
|
+
extraKeys: ['memoryConfig'],
|
|
47
|
+
example: { type: 'builtin', name: 'workspace_memory', builtinType: 'workspace_memory' },
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
value: 'kg_search',
|
|
51
|
+
description: 'Vector search over Knowledge Graph text entries. Returns ranked rows with snippets.',
|
|
52
|
+
providers: ['all'],
|
|
53
|
+
example: { type: 'builtin', name: 'kg_search', builtinType: 'kg_search' },
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
value: 'kg_traverse',
|
|
57
|
+
description: 'Traverse KG edges from a node. Returns related entities and relationship types.',
|
|
58
|
+
providers: ['all'],
|
|
59
|
+
example: { type: 'builtin', name: 'kg_traverse', builtinType: 'kg_traverse' },
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
value: 'kg_nodes',
|
|
63
|
+
description: 'Fetch specific KG nodes by ID or by list key (structured row lookup).',
|
|
64
|
+
providers: ['all'],
|
|
65
|
+
example: { type: 'builtin', name: 'kg_nodes', builtinType: 'kg_nodes' },
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
value: 'kg_write',
|
|
69
|
+
description: 'Write rows, edges, or insights to the Knowledge Graph (bounded, not for large bulk — use `knowledgeSync` step for that).',
|
|
70
|
+
providers: ['all'],
|
|
71
|
+
example: { type: 'builtin', name: 'kg_write', builtinType: 'kg_write' },
|
|
72
|
+
},
|
|
73
|
+
];
|
|
74
|
+
export const VALID_BUILTIN_TOOL_VALUES = new Set(BUILTIN_TOOLS_CATALOG.map(t => t.value));
|
|
75
|
+
/**
|
|
76
|
+
* Heuristic "did you mean" for the most common invented / typo'd builtinType values.
|
|
77
|
+
*/
|
|
78
|
+
export function suggestBuiltinToolFix(invalid) {
|
|
79
|
+
const v = invalid.toLowerCase();
|
|
80
|
+
const map = {
|
|
81
|
+
'web-search': 'Use `web_search` (underscore).',
|
|
82
|
+
'websearch': 'Use `web_search` (with underscore).',
|
|
83
|
+
'search': 'Use `web_search` for the web or `kg_search` for the Knowledge Graph — `search` alone is not a builtin.',
|
|
84
|
+
'google_search': 'Use `web_search` — we abstract the provider so it works across Anthropic/OpenAI/Moonshot.',
|
|
85
|
+
'memory': 'Use `workspace_memory` — the canonical name.',
|
|
86
|
+
'workspace-memory': 'Use `workspace_memory` (underscore).',
|
|
87
|
+
'knowledge_graph': 'Pick one of `kg_search` / `kg_traverse` / `kg_nodes` / `kg_write` — `knowledge_graph` is not itself a builtin.',
|
|
88
|
+
'kg': 'Pick one of `kg_search` / `kg_traverse` / `kg_nodes` / `kg_write`.',
|
|
89
|
+
'code': 'Use `code_interpreter` (the canonical builtin) or switch to a `code` step for JS/Python without an LLM.',
|
|
90
|
+
'scrape': 'Use `fetch_website_content` — `scrape` is a `web-scraping` app action, not a builtin.',
|
|
91
|
+
'fetch': 'Use `fetch_website_content`.',
|
|
92
|
+
'fetch_url': 'Use `fetch_website_content`.',
|
|
93
|
+
};
|
|
94
|
+
return map[v];
|
|
95
|
+
}
|
|
96
|
+
//# sourceMappingURL=builtin-tools-catalog.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"builtin-tools-catalog.js","sourceRoot":"","sources":["../src/builtin-tools-catalog.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAqBH,MAAM,CAAC,MAAM,qBAAqB,GAAqB;IACnD;QACI,KAAK,EAAE,YAAY;QACnB,WAAW,EAAE,0EAA0E;QACvF,SAAS,EAAE,CAAC,KAAK,CAAC;QAClB,qBAAqB,EAAE,CAAC;QACxB,OAAO,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,YAAY,EAAE,WAAW,EAAE,YAAY,EAAE;KAC9E;IACD;QACI,KAAK,EAAE,uBAAuB;QAC9B,WAAW,EAAE,mFAAmF;QAChG,SAAS,EAAE,CAAC,KAAK,CAAC;QAClB,qBAAqB,EAAE,CAAC;QACxB,OAAO,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,uBAAuB,EAAE,WAAW,EAAE,uBAAuB,EAAE;KACpG;IACD;QACI,KAAK,EAAE,aAAa;QACpB,WAAW,EAAE,+DAA+D;QAC5E,SAAS,EAAE,CAAC,QAAQ,CAAC;QACrB,OAAO,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,aAAa,EAAE,WAAW,EAAE,aAAa,EAAE;KAChF;IACD;QACI,KAAK,EAAE,kBAAkB;QACzB,WAAW,EAAE,mFAAmF;QAChG,SAAS,EAAE,CAAC,QAAQ,EAAE,WAAW,CAAC;QAClC,qBAAqB,EAAE,CAAC;QACxB,OAAO,EAAE,EAAE,IAAI,EAAE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AC,CAAC;AAE1F;;GAEG;AACH,MAAM,UAAU,qBAAqB,CAAC,OAAe;IACjD,MAAM,CAAC,GAAG,OAAO,CAAC,WAAW,EAAE,CAAC;IAChC,MAAM,GAAG,GAA2B;QAChC,YAAY,EAAE,gCAAgC;QAC9C,WAAW,EAAE,qCAAqC;QAClD,QAAQ,EAAE,wGAAwG;QAClH,eAAe,EAAE,2FAA2F;QAC5G,QAAQ,EAAE,8CAA8C;QACxD,kBAAkB,EAAE,sCAAsC;QAC1D,iBAAiB,EAAE,gHAAgH;QACnI,IAAI,EAAE,oEAAoE;QAC1E,MAAM,EAAE,yGAAyG;QACjH,QAAQ,EAAE,uFAAuF;QACjG,OAAO,EAAE,8BAA8B;QACvC,WAAW,EAAE,8BAA8B;KAC9C,CAAC;IACF,OAAO,GAAG,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC"}
|
package/dist/commands/auth.js
CHANGED
|
@@ -5,6 +5,7 @@ import { getBaseUrl, getConfigPath, getSelectedWorkspace, listWorkspaces, loadCo
|
|
|
5
5
|
import { browserLogin } from '../utils/browser-auth.js';
|
|
6
6
|
import { printError, printOutput } from '../utils/output.js';
|
|
7
7
|
import { runOnboarding } from './onboarding.js';
|
|
8
|
+
import { getSkillsTargetDir, installSkills, summarizeForLoginBanner, } from '../utils/skills.js';
|
|
8
9
|
function prompt(question) {
|
|
9
10
|
const rl = readline.createInterface({ input: process.stdin, output: process.stderr });
|
|
10
11
|
return new Promise(resolve => {
|
|
@@ -48,6 +49,31 @@ function printSavedWorkspaceSummary() {
|
|
|
48
49
|
const count = savedWorkspaces.length;
|
|
49
50
|
console.log(`Saved ${count} ${pluralize(count, 'workspace', 'workspaces')}. Use "agentled auth list" to inspect them.`);
|
|
50
51
|
}
|
|
52
|
+
/**
|
|
53
|
+
* Installs the Agentled Claude Code skill into ~/.claude/skills on successful
|
|
54
|
+
* login. Silently no-op'd by --skip-skills. Never blocks login on failure —
|
|
55
|
+
* skills are a convenience, not a hard requirement.
|
|
56
|
+
*
|
|
57
|
+
* This is what closes silent-strip-class bugs: without the skill auto-loaded,
|
|
58
|
+
* agents invent step types (`type: "ai"`, `knowledge_graph_query`) that the
|
|
59
|
+
* API silently strips.
|
|
60
|
+
*/
|
|
61
|
+
function installSkillsAfterLogin(skipSkills) {
|
|
62
|
+
if (skipSkills)
|
|
63
|
+
return;
|
|
64
|
+
try {
|
|
65
|
+
const targetDir = getSkillsTargetDir(true); // default: global
|
|
66
|
+
const results = installSkills({ global: true });
|
|
67
|
+
const banner = summarizeForLoginBanner(results, targetDir);
|
|
68
|
+
if (banner) {
|
|
69
|
+
console.log(banner);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
catch (err) {
|
|
73
|
+
// Never fail login because of skill install. Surface a hint instead.
|
|
74
|
+
console.log(`(Skill auto-install skipped: ${err?.message ?? String(err)}. Run \`agentled skills install\` manually.)`);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
51
77
|
export function registerAuthCommands(program) {
|
|
52
78
|
const auth = program.command('auth').description('Manage authentication');
|
|
53
79
|
auth
|
|
@@ -57,6 +83,7 @@ export function registerAuthCommands(program) {
|
|
|
57
83
|
.option('--alias <alias>', 'Optional local alias for this workspace profile')
|
|
58
84
|
.option('--url <baseUrl>', 'Base URL (default: https://www.agentled.app)')
|
|
59
85
|
.option('--no-browser', 'Skip browser flow, prompt for API key instead')
|
|
86
|
+
.option('--skip-skills', 'Skip auto-installing the Claude Code skill on successful login')
|
|
60
87
|
.action(async (opts) => {
|
|
61
88
|
const baseUrl = opts.url || getBaseUrl();
|
|
62
89
|
if (opts.key) {
|
|
@@ -75,6 +102,7 @@ export function registerAuthCommands(program) {
|
|
|
75
102
|
});
|
|
76
103
|
console.log(`Authenticated to workspace "${workspace.workspaceName}" ✓`);
|
|
77
104
|
printSavedWorkspaceSummary();
|
|
105
|
+
installSkillsAfterLogin(Boolean(opts.skipSkills));
|
|
78
106
|
return;
|
|
79
107
|
}
|
|
80
108
|
catch (error) {
|
|
@@ -98,6 +126,7 @@ export function registerAuthCommands(program) {
|
|
|
98
126
|
});
|
|
99
127
|
console.log(`Authenticated to workspace "${workspace.workspaceName}" ✓`);
|
|
100
128
|
printSavedWorkspaceSummary();
|
|
129
|
+
installSkillsAfterLogin(Boolean(opts.skipSkills));
|
|
101
130
|
return;
|
|
102
131
|
}
|
|
103
132
|
catch (error) {
|
|
@@ -118,6 +147,7 @@ export function registerAuthCommands(program) {
|
|
|
118
147
|
});
|
|
119
148
|
console.log(`Authenticated to workspace "${result.workspaceName}" ✓`);
|
|
120
149
|
printSavedWorkspaceSummary();
|
|
150
|
+
installSkillsAfterLogin(Boolean(opts.skipSkills));
|
|
121
151
|
if (result.isNewUser) {
|
|
122
152
|
await runOnboarding();
|
|
123
153
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auth.js","sourceRoot":"","sources":["../../src/commands/auth.ts"],"names":[],"mappings":"AAAA,+BAA+B;AAE/B,OAAO,KAAK,QAAQ,MAAM,eAAe,CAAC;AAE1C,OAAO,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACnD,OAAO,EACH,UAAU,EACV,aAAa,EACb,oBAAoB,EACpB,cAAc,EACd,UAAU,EACV,eAAe,EACf,kBAAkB,EAClB,oBAAoB,EACpB,kBAAkB,EAClB,YAAY,GAEf,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AACxD,OAAO,EAAE,UAAU,EAAE,WAAW,EAAqB,MAAM,oBAAoB,CAAC;AAChF,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"auth.js","sourceRoot":"","sources":["../../src/commands/auth.ts"],"names":[],"mappings":"AAAA,+BAA+B;AAE/B,OAAO,KAAK,QAAQ,MAAM,eAAe,CAAC;AAE1C,OAAO,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACnD,OAAO,EACH,UAAU,EACV,aAA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AAC;IAEP,IAAI;SACC,OAAO,CAAC,QAAQ,CAAC;SACjB,WAAW,CAAC,+BAA+B,CAAC;SAC5C,MAAM,CAAC,GAAG,EAAE;QACT,IAAI,YAAY,EAAE,EAAE,CAAC;YACjB,OAAO,CAAC,GAAG,CAAC,2CAA2C,CAAC,CAAC;QAC7D,CAAC;aAAM,CAAC;YACJ,OAAO,CAAC,GAAG,CAAC,8BAA8B,CAAC,CAAC;QAChD,CAAC;IACL,CAAC,CAAC,CAAC;IAEP,IAAI;SACC,OAAO,CAAC,QAAQ,CAAC;SACjB,WAAW,CAAC,wBAAwB,CAAC;SACrC,MAAM,CAAC,gBAAgB,EAAE,eAAe,EAAE,MAAM,CAAC;SACjD,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE;QACb,MAAM,WAAW,GAAG,kBAAkB,EAAE,CAAC;QACzC,MAAM,UAAU,GAAG,cAAc,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC;QAE7D,WAAW,CAAC;YACR,aAAa,EAAE,WAAW,CAAC,aAAa;YACxC,MAAM,EAAE,WAAW,CAAC,MAAM;YAC1B,OAAO,EAAE,WAAW,CAAC,OAAO;YAC5B,UAAU,EAAE,aAAa,EAAE;YAC3B,eAAe,EAAE,WAAW,CAAC,SAAS,IAAI,IAAI;YAC9C,mBAAmB,EAAE,UAAU;SAClC,EAAE,IAAI,CAAC,MAAsB,CAAC,CAAC;IACpC,CAAC,CAAC,CAAC;AACX,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `agentled examples` — surface the agentic-ops patterns bundled with the CLI.
|
|
3
|
+
*
|
|
4
|
+
* The patterns are maintained in the public `agentled/agentic-ops` repo and
|
|
5
|
+
* mirrored into `packages/cli/patterns/v1/` at build time. A drift test in
|
|
6
|
+
* `__tests__/cli-patterns-mirror.test.ts` enforces byte-identity between the
|
|
7
|
+
* two copies so the CLI cannot ship stale advice.
|
|
8
|
+
*
|
|
9
|
+
* Usage:
|
|
10
|
+
* agentled examples # list all patterns
|
|
11
|
+
* agentled examples trigger-design # print pattern 01-trigger-design.md
|
|
12
|
+
* agentled examples 02 # print pattern 02-dedup-gates.md
|
|
13
|
+
*/
|
|
14
|
+
import { Command } from 'commander';
|
|
15
|
+
export declare function registerExamplesCommand(program: Command): void;
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
/* eslint-disable no-console */
|
|
2
|
+
import { existsSync, readdirSync, readFileSync } from 'node:fs';
|
|
3
|
+
import { join, dirname, resolve } from 'node:path';
|
|
4
|
+
import { fileURLToPath } from 'node:url';
|
|
5
|
+
const PUBLIC_REPO_URL = 'https://github.com/agentled/agentic-ops';
|
|
6
|
+
function resolveBundledPatternsDir() {
|
|
7
|
+
const here = fileURLToPath(import.meta.url);
|
|
8
|
+
// dist/commands/examples.js → package root is two levels up
|
|
9
|
+
const pkgRoot = resolve(dirname(here), '..', '..');
|
|
10
|
+
return join(pkgRoot, 'patterns', 'v1');
|
|
11
|
+
}
|
|
12
|
+
function loadPatterns() {
|
|
13
|
+
const dir = resolveBundledPatternsDir();
|
|
14
|
+
if (!existsSync(dir))
|
|
15
|
+
return [];
|
|
16
|
+
return readdirSync(dir)
|
|
17
|
+
.filter(f => f.endsWith('.md'))
|
|
18
|
+
.sort()
|
|
19
|
+
.map(file => {
|
|
20
|
+
const path = join(dir, file);
|
|
21
|
+
const slug = file.replace(/\.md$/, '');
|
|
22
|
+
const m = slug.match(/^(\d+)-(.+)$/);
|
|
23
|
+
const content = readFileSync(path, 'utf-8');
|
|
24
|
+
const titleMatch = content.match(/^#\s+(.+)$/m);
|
|
25
|
+
return {
|
|
26
|
+
slug,
|
|
27
|
+
number: m?.[1] ?? '',
|
|
28
|
+
keyword: m?.[2] ?? slug,
|
|
29
|
+
title: titleMatch?.[1]?.trim() ?? slug,
|
|
30
|
+
path,
|
|
31
|
+
};
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
function findPattern(patterns, query) {
|
|
35
|
+
const q = query.toLowerCase().replace(/^0+/, '');
|
|
36
|
+
// Exact slug match
|
|
37
|
+
const slug = patterns.find(p => p.slug.toLowerCase() === query.toLowerCase());
|
|
38
|
+
if (slug)
|
|
39
|
+
return slug;
|
|
40
|
+
// Match by number (with or without leading zero)
|
|
41
|
+
const num = patterns.find(p => p.number.replace(/^0+/, '') === q);
|
|
42
|
+
if (num)
|
|
43
|
+
return num;
|
|
44
|
+
// Match by keyword (trigger-design, dedup-gates, etc.)
|
|
45
|
+
const kw = patterns.find(p => p.keyword.toLowerCase() === query.toLowerCase());
|
|
46
|
+
if (kw)
|
|
47
|
+
return kw;
|
|
48
|
+
// Partial keyword match
|
|
49
|
+
const partial = patterns.find(p => p.keyword.toLowerCase().includes(query.toLowerCase()));
|
|
50
|
+
if (partial)
|
|
51
|
+
return partial;
|
|
52
|
+
return null;
|
|
53
|
+
}
|
|
54
|
+
export function registerExamplesCommand(program) {
|
|
55
|
+
program
|
|
56
|
+
.command('examples [pattern]')
|
|
57
|
+
.alias('patterns')
|
|
58
|
+
.description('Show Agentled workflow best-practice patterns (trigger design, dedup gates, loops, …).')
|
|
59
|
+
.option('--list', 'List available patterns (default when no pattern is given)')
|
|
60
|
+
.action((pattern, opts) => {
|
|
61
|
+
const patterns = loadPatterns();
|
|
62
|
+
if (patterns.length === 0) {
|
|
63
|
+
console.error('No bundled patterns found. Reinstall @agentled/cli.');
|
|
64
|
+
process.exit(1);
|
|
65
|
+
}
|
|
66
|
+
if (!pattern || opts.list) {
|
|
67
|
+
console.log('Available patterns (public source: ' + PUBLIC_REPO_URL + '/tree/main/patterns/v1):\n');
|
|
68
|
+
for (const p of patterns) {
|
|
69
|
+
console.log(` ${p.slug.padEnd(30)} ${p.title}`);
|
|
70
|
+
}
|
|
71
|
+
console.log('\nUsage:');
|
|
72
|
+
console.log(' agentled examples <pattern> # e.g. `agentled examples trigger-design` or `agentled examples 01`');
|
|
73
|
+
return;
|
|
74
|
+
}
|
|
75
|
+
const found = findPattern(patterns, pattern);
|
|
76
|
+
if (!found) {
|
|
77
|
+
console.error(`Pattern "${pattern}" not found. Run \`agentled examples\` to list available patterns.`);
|
|
78
|
+
process.exit(1);
|
|
79
|
+
}
|
|
80
|
+
console.log(readFileSync(found.path, 'utf-8'));
|
|
81
|
+
console.log(`\n---\nSource: ${PUBLIC_REPO_URL}/blob/main/patterns/v1/${found.slug}.md`);
|
|
82
|
+
});
|
|
83
|
+
program
|
|
84
|
+
.command('best-practices')
|
|
85
|
+
.description('Show where to find Agentled workflow best practices (agentic-ops repo).')
|
|
86
|
+
.action(() => {
|
|
87
|
+
console.log('Agentled workflow best practices are published at:');
|
|
88
|
+
console.log(` ${PUBLIC_REPO_URL}`);
|
|
89
|
+
console.log('');
|
|
90
|
+
console.log('Core patterns are bundled with this CLI and readable offline:');
|
|
91
|
+
console.log(' agentled examples # list patterns');
|
|
92
|
+
console.log(' agentled examples <pattern> # print a specific pattern');
|
|
93
|
+
console.log('');
|
|
94
|
+
console.log('Categories (v1):');
|
|
95
|
+
for (const p of loadPatterns()) {
|
|
96
|
+
console.log(` - ${p.title}`);
|
|
97
|
+
}
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
//# sourceMappingURL=examples.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"examples.js","sourceRoot":"","sources":["../../src/commands/examples.ts"],"names":[],"mappings":"AAAA,+BAA+B;AAiB/B,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAChE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACnD,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC,MAAM,eAAe,GAAG,yCAAyC,CAAC;AAElE,SAAS,yBAAyB;IAC9B,MAAM,IAAI,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAC5C,4DAA4D;I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AO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;QAChB,OAAO,CAAC,GAAG,CAAC,+DAA+D,CAAC,CAAC;QAC7E,OAAO,CAAC,GAAG,CAAC,kDAAkD,CAAC,CAAC;QAChE,OAAO,CAAC,GAAG,CAAC,6DAA6D,CAAC,CAAC;QAC3E,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;QAChB,OAAO,CAAC,GAAG,CAAC,kBAAkB,CAAC,CAAC;QAChC,KAAK,MAAM,CAAC,IAAI,YAAY,EAAE,EAAE,CAAC;YAC7B,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,CAAC,CAAC;QAClC,CAAC;IACL,CAAC,CAAC,CAAC;AACX,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `agentled workflows scaffold` — emit a working pipeline JSON skeleton the
|
|
3
|
+
* user can adapt. Saves 200+ lines of guess-and-validate authoring.
|
|
4
|
+
*
|
|
5
|
+
* Each scaffold is a real, preflight-passing pipeline JSON that covers one of
|
|
6
|
+
* the core patterns (lead-scoring-kg, list-match-email, extract-threshold-
|
|
7
|
+
* alert, email-polling-dedup, minimal). They reference the matching pattern
|
|
8
|
+
* file in `agentled examples <pattern>` for the full explanation. See
|
|
9
|
+
* scaffolds/README.md for the contract; drop JSON files in
|
|
10
|
+
* ~/.agentled/scaffolds/ or set AGENTLED_SCAFFOLDS_DIR for local/team
|
|
11
|
+
* scaffolds that shadow the bundled set.
|
|
12
|
+
*/
|
|
13
|
+
import { Command } from 'commander';
|
|
14
|
+
export declare function registerScaffoldCommand(workflows: Command): void;
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
/* eslint-disable no-console */
|
|
2
|
+
import { existsSync, readFileSync, readdirSync, writeFileSync } from 'node:fs';
|
|
3
|
+
import { join, dirname, resolve } from 'node:path';
|
|
4
|
+
import { homedir } from 'node:os';
|
|
5
|
+
import { fileURLToPath } from 'node:url';
|
|
6
|
+
function resolveBundledScaffoldsDir() {
|
|
7
|
+
const here = fileURLToPath(import.meta.url);
|
|
8
|
+
// dist/commands/scaffold.js → package root is two levels up
|
|
9
|
+
const pkgRoot = resolve(dirname(here), '..', '..');
|
|
10
|
+
return join(pkgRoot, 'scaffolds');
|
|
11
|
+
}
|
|
12
|
+
function resolveLocalScaffoldDirs() {
|
|
13
|
+
const dirs = [];
|
|
14
|
+
if (process.env.AGENTLED_SCAFFOLDS_DIR)
|
|
15
|
+
dirs.push(process.env.AGENTLED_SCAFFOLDS_DIR);
|
|
16
|
+
dirs.push(join(homedir(), '.agentled', 'scaffolds'));
|
|
17
|
+
return dirs.filter(existsSync);
|
|
18
|
+
}
|
|
19
|
+
function readDir(dir, source) {
|
|
20
|
+
if (!existsSync(dir))
|
|
21
|
+
return [];
|
|
22
|
+
return readdirSync(dir)
|
|
23
|
+
.filter(f => f.endsWith('.json'))
|
|
24
|
+
.map(file => {
|
|
25
|
+
const path = join(dir, file);
|
|
26
|
+
const slug = file.replace(/\.json$/, '');
|
|
27
|
+
try {
|
|
28
|
+
const obj = JSON.parse(readFileSync(path, 'utf-8'));
|
|
29
|
+
return { slug, name: obj.name ?? slug, goal: obj.goal ?? '', path, source };
|
|
30
|
+
}
|
|
31
|
+
catch {
|
|
32
|
+
return { slug, name: slug, goal: '(invalid JSON)', path, source };
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
function loadScaffolds() {
|
|
37
|
+
// Local scaffolds shadow bundled ones with the same slug. Enables a
|
|
38
|
+
// workspace / customer / team to ship their own scaffold library without
|
|
39
|
+
// waiting on a CLI release, while keeping the bundled patterns as a
|
|
40
|
+
// canonical fallback.
|
|
41
|
+
const bundled = readDir(resolveBundledScaffoldsDir(), 'bundled');
|
|
42
|
+
const local = [];
|
|
43
|
+
for (const dir of resolveLocalScaffoldDirs())
|
|
44
|
+
local.push(...readDir(dir, 'local'));
|
|
45
|
+
const bySlug = new Map();
|
|
46
|
+
for (const s of bundled)
|
|
47
|
+
bySlug.set(s.slug, s);
|
|
48
|
+
for (const s of local)
|
|
49
|
+
bySlug.set(s.slug, s); // local wins
|
|
50
|
+
return [...bySlug.values()].sort((a, b) => a.slug.localeCompare(b.slug));
|
|
51
|
+
}
|
|
52
|
+
function findScaffold(scaffolds, query) {
|
|
53
|
+
const q = query.toLowerCase();
|
|
54
|
+
return (scaffolds.find(s => s.slug.toLowerCase() === q) ??
|
|
55
|
+
scaffolds.find(s => s.slug.toLowerCase().includes(q)) ??
|
|
56
|
+
null);
|
|
57
|
+
}
|
|
58
|
+
export function registerScaffoldCommand(workflows) {
|
|
59
|
+
workflows
|
|
60
|
+
.command('scaffold [pattern]')
|
|
61
|
+
.description('Emit a working pipeline JSON skeleton for a named pattern. Run without args to list available scaffolds.')
|
|
62
|
+
.option('--list', 'List available scaffolds')
|
|
63
|
+
.option('--out <path>', 'Write the scaffold JSON to this path instead of stdout')
|
|
64
|
+
.action((pattern, opts) => {
|
|
65
|
+
const scaffolds = loadScaffolds();
|
|
66
|
+
if (scaffolds.length === 0) {
|
|
67
|
+
console.error('No scaffolds bundled with this CLI version.');
|
|
68
|
+
process.exit(1);
|
|
69
|
+
}
|
|
70
|
+
if (!pattern || opts.list) {
|
|
71
|
+
console.log('Available scaffolds:\n');
|
|
72
|
+
for (const s of scaffolds) {
|
|
73
|
+
const tag = s.source === 'local' ? ' [local]' : '';
|
|
74
|
+
console.log(` ${s.slug.padEnd(28)}${tag.padEnd(8)} ${s.name}`);
|
|
75
|
+
if (s.goal)
|
|
76
|
+
console.log(` ${' '.repeat(36)} ${s.goal}`);
|
|
77
|
+
}
|
|
78
|
+
console.log('\nUsage:');
|
|
79
|
+
console.log(' agentled workflows scaffold <pattern> # print JSON to stdout');
|
|
80
|
+
console.log(' agentled workflows scaffold <pattern> --out x.json # write to file');
|
|
81
|
+
console.log(' agentled workflows validate --file x.json # preflight before create');
|
|
82
|
+
console.log(' agentled workflows create --file x.json # create + auto-validate');
|
|
83
|
+
console.log('\nBring your own: drop JSON files in ~/.agentled/scaffolds/ or set');
|
|
84
|
+
console.log('$AGENTLED_SCAFFOLDS_DIR. Local slugs shadow bundled ones with the same name.');
|
|
85
|
+
return;
|
|
86
|
+
}
|
|
87
|
+
const found = findScaffold(scaffolds, pattern);
|
|
88
|
+
if (!found) {
|
|
89
|
+
console.error(`Scaffold "${pattern}" not found. Run \`agentled workflows scaffold --list\` for available scaffolds.`);
|
|
90
|
+
process.exit(1);
|
|
91
|
+
}
|
|
92
|
+
const content = readFileSync(found.path, 'utf-8');
|
|
93
|
+
if (opts.out) {
|
|
94
|
+
writeFileSync(opts.out, content);
|
|
95
|
+
console.error(` ✓ Wrote ${found.slug} to ${opts.out}`);
|
|
96
|
+
console.error(` Next: agentled workflows validate --file ${opts.out}`);
|
|
97
|
+
}
|
|
98
|
+
else {
|
|
99
|
+
process.stdout.write(content);
|
|
100
|
+
}
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
//# sourceMappingURL=scaffold.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scaffold.js","sourceRoot":"","sources":["../../src/commands/scaffold.ts"],"names":[],"mappings":"AAAA,+BAA+B;AAgB/B,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAC/E,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACnD,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAUzC,SAAS,0BAA0B;IAC/B,MAAM,IAAI,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAC5C,4DAA4D;IAC5D,MAAM,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;IACnD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