@ory/argus 0.1.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.
Files changed (80) hide show
  1. package/README.md +134 -0
  2. package/assets/commands/local-down.md +19 -0
  3. package/assets/commands/local-up.md +27 -0
  4. package/assets/skills/auth-setup/SKILL.md +279 -0
  5. package/assets/skills/local-dev/SKILL.md +206 -0
  6. package/assets/skills/login-flow/SKILL.md +383 -0
  7. package/assets/skills/social-login/SKILL.md +312 -0
  8. package/dist/agent-auth.d.ts +204 -0
  9. package/dist/agent-auth.js +553 -0
  10. package/dist/auth-gate.d.ts +71 -0
  11. package/dist/auth-gate.js +308 -0
  12. package/dist/auth-store.d.ts +75 -0
  13. package/dist/auth-store.js +261 -0
  14. package/dist/auth.d.ts +93 -0
  15. package/dist/auth.js +323 -0
  16. package/dist/cli.d.ts +73 -0
  17. package/dist/cli.js +484 -0
  18. package/dist/client.d.ts +158 -0
  19. package/dist/client.js +679 -0
  20. package/dist/config.d.ts +135 -0
  21. package/dist/config.js +344 -0
  22. package/dist/denial.d.ts +79 -0
  23. package/dist/denial.js +103 -0
  24. package/dist/dev.d.ts +95 -0
  25. package/dist/dev.js +514 -0
  26. package/dist/index.d.ts +20 -0
  27. package/dist/index.js +137 -0
  28. package/dist/local/cli.d.ts +12 -0
  29. package/dist/local/cli.js +95 -0
  30. package/dist/local/configs.d.ts +89 -0
  31. package/dist/local/configs.js +634 -0
  32. package/dist/local/health.d.ts +32 -0
  33. package/dist/local/health.js +65 -0
  34. package/dist/local/index.d.ts +6 -0
  35. package/dist/local/index.js +38 -0
  36. package/dist/local/jaeger-main.d.ts +13 -0
  37. package/dist/local/jaeger-main.js +85 -0
  38. package/dist/local/jaeger.d.ts +50 -0
  39. package/dist/local/jaeger.js +162 -0
  40. package/dist/local/main.d.ts +7 -0
  41. package/dist/local/main.js +14 -0
  42. package/dist/local/manager.d.ts +45 -0
  43. package/dist/local/manager.js +676 -0
  44. package/dist/local/seed.d.ts +71 -0
  45. package/dist/local/seed.js +237 -0
  46. package/dist/logger.d.ts +29 -0
  47. package/dist/logger.js +139 -0
  48. package/dist/mcp.d.ts +76 -0
  49. package/dist/mcp.js +122 -0
  50. package/dist/otel/exporter.d.ts +17 -0
  51. package/dist/otel/exporter.js +12 -0
  52. package/dist/otel/index.d.ts +2 -0
  53. package/dist/otel/index.js +8 -0
  54. package/dist/otel/otlp-http.d.ts +116 -0
  55. package/dist/otel/otlp-http.js +322 -0
  56. package/dist/registry/cli.d.ts +12 -0
  57. package/dist/registry/cli.js +76 -0
  58. package/dist/registry/config.d.ts +23 -0
  59. package/dist/registry/config.js +80 -0
  60. package/dist/registry/index.d.ts +3 -0
  61. package/dist/registry/index.js +21 -0
  62. package/dist/registry/main.d.ts +7 -0
  63. package/dist/registry/main.js +14 -0
  64. package/dist/registry/manager.d.ts +38 -0
  65. package/dist/registry/manager.js +674 -0
  66. package/dist/setup.d.ts +118 -0
  67. package/dist/setup.js +398 -0
  68. package/dist/skills.d.ts +78 -0
  69. package/dist/skills.js +264 -0
  70. package/dist/subject.d.ts +43 -0
  71. package/dist/subject.js +55 -0
  72. package/dist/tool-metadata.d.ts +41 -0
  73. package/dist/tool-metadata.js +127 -0
  74. package/dist/tracer.d.ts +172 -0
  75. package/dist/tracer.js +452 -0
  76. package/dist/types.d.ts +57 -0
  77. package/dist/types.js +3 -0
  78. package/dist/watch-sandbox.d.ts +9 -0
  79. package/dist/watch-sandbox.js +81 -0
  80. package/package.json +79 -0
@@ -0,0 +1,118 @@
1
+ export interface SetupArgs {
2
+ projectDir: string;
3
+ global: boolean;
4
+ print: boolean;
5
+ uninstall: boolean;
6
+ }
7
+ export interface HookCommand {
8
+ type: string;
9
+ command: string;
10
+ }
11
+ export interface MatcherEntry {
12
+ matcher: string;
13
+ hooks: HookCommand[];
14
+ }
15
+ /**
16
+ * Parse standard setup CLI arguments from process.argv.
17
+ */
18
+ export declare function parseSetupArgs(opts?: {
19
+ supportsGlobal?: boolean;
20
+ }): SetupArgs;
21
+ /**
22
+ * Read and parse a JSON file. Returns empty object if file doesn't exist or is invalid.
23
+ */
24
+ export declare function readJsonFile(filePath: string): Record<string, unknown>;
25
+ /**
26
+ * Write a JSON file, creating parent directories if needed.
27
+ */
28
+ export declare function writeJsonFile(filePath: string, data: unknown): void;
29
+ /**
30
+ * Check if a hook command belongs to an Ory plugin.
31
+ */
32
+ export declare function isOryHookCommand(h: HookCommand, binName: string): boolean;
33
+ /**
34
+ * Resolve the hook command string for a plugin.
35
+ * Tries require.resolve first, falls back to the global bin name.
36
+ */
37
+ export declare function resolveHookCommand(packageName: string, binName: string): string;
38
+ /**
39
+ * Build a matcher-based hook entry: `[{ matcher: "", hooks: [{ type: "command", command }] }]`
40
+ */
41
+ export declare function matcherHookEntry(cmd: string): MatcherEntry[];
42
+ /**
43
+ * Merge matcher-based hooks into existing settings, replacing any existing Ory entries.
44
+ */
45
+ export declare function mergeMatcherHooks(existing: Record<string, unknown>, newHooks: Record<string, MatcherEntry[]>, binName: string): Record<string, unknown>;
46
+ /**
47
+ * Remove all Ory matcher-based hooks from existing settings.
48
+ */
49
+ export declare function removeMatcherHooks(existing: Record<string, unknown>, binName: string): Record<string, unknown>;
50
+ /**
51
+ * Build a flat hook entry: `[{ type: "command", command }]`
52
+ */
53
+ export declare function flatHookEntry(cmd: string): HookCommand[];
54
+ /**
55
+ * Merge flat hooks into existing config, replacing any existing Ory entries.
56
+ */
57
+ export declare function mergeFlatHooks(existing: Record<string, unknown>, newHooks: Record<string, HookCommand[]>, binName: string): Record<string, unknown>;
58
+ /**
59
+ * Remove all Ory flat hooks from existing config.
60
+ */
61
+ export declare function removeFlatHooks(existing: Record<string, unknown>, binName: string): Record<string, unknown>;
62
+ /**
63
+ * Resolve the command + args needed to run the Ory MCP server.
64
+ * Tries require.resolve first, falls back to the global bin name.
65
+ */
66
+ export declare function resolveMcpServerCommand(): {
67
+ command: string;
68
+ args: string[];
69
+ };
70
+ /**
71
+ * Generate the mcpServers config object for the Ory MCP server.
72
+ */
73
+ export declare function mcpServerEntry(cmd?: {
74
+ command: string;
75
+ args: string[];
76
+ }): Record<string, unknown>;
77
+ /**
78
+ * Merge the Ory MCP server into an existing settings object's `mcpServers` key.
79
+ * Pass an optional `cmd` to override the default resolution (useful when the
80
+ * caller can resolve the mcp-server entry point more reliably than core can).
81
+ */
82
+ export declare function mergeMcpServer(existing: Record<string, unknown>, cmd?: {
83
+ command: string;
84
+ args: string[];
85
+ }): Record<string, unknown>;
86
+ /**
87
+ * Remove the Ory MCP server from an existing settings object's `mcpServers` key.
88
+ */
89
+ export declare function removeMcpServer(existing: Record<string, unknown>): Record<string, unknown>;
90
+ /**
91
+ * Register a plugin in the Claude Code plugins registry.
92
+ */
93
+ export declare function registerPlugin(opts: {
94
+ name: string;
95
+ installPath: string;
96
+ version: string;
97
+ scope: "project" | "user";
98
+ projectPath?: string;
99
+ }): void;
100
+ /**
101
+ * Unregister a plugin from the Claude Code plugins registry.
102
+ */
103
+ export declare function unregisterPlugin(opts: {
104
+ name: string;
105
+ scope: "project" | "user";
106
+ projectPath?: string;
107
+ }): void;
108
+ /**
109
+ * Print the standard setup help text showing supported environment variables.
110
+ */
111
+ export declare function printSetupHelp(binName: string, harnessName: string, opts?: {
112
+ supportsGlobal?: boolean;
113
+ globalPath?: string;
114
+ }): void;
115
+ /**
116
+ * Print the "Next steps" text after successful setup.
117
+ */
118
+ export declare function printNextSteps(harnessName: string, uninstallCmd: string): void;
package/dist/setup.js ADDED
@@ -0,0 +1,398 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.parseSetupArgs = parseSetupArgs;
37
+ exports.readJsonFile = readJsonFile;
38
+ exports.writeJsonFile = writeJsonFile;
39
+ exports.isOryHookCommand = isOryHookCommand;
40
+ exports.resolveHookCommand = resolveHookCommand;
41
+ exports.matcherHookEntry = matcherHookEntry;
42
+ exports.mergeMatcherHooks = mergeMatcherHooks;
43
+ exports.removeMatcherHooks = removeMatcherHooks;
44
+ exports.flatHookEntry = flatHookEntry;
45
+ exports.mergeFlatHooks = mergeFlatHooks;
46
+ exports.removeFlatHooks = removeFlatHooks;
47
+ exports.resolveMcpServerCommand = resolveMcpServerCommand;
48
+ exports.mcpServerEntry = mcpServerEntry;
49
+ exports.mergeMcpServer = mergeMcpServer;
50
+ exports.removeMcpServer = removeMcpServer;
51
+ exports.registerPlugin = registerPlugin;
52
+ exports.unregisterPlugin = unregisterPlugin;
53
+ exports.printSetupHelp = printSetupHelp;
54
+ exports.printNextSteps = printNextSteps;
55
+ const fs = __importStar(require("node:fs"));
56
+ const path = __importStar(require("node:path"));
57
+ // ─── Arg Parsing ───────────────────────────────────────────────────
58
+ /**
59
+ * Parse standard setup CLI arguments from process.argv.
60
+ */
61
+ function parseSetupArgs(opts) {
62
+ const args = process.argv.slice(2);
63
+ const result = {
64
+ projectDir: process.cwd(),
65
+ global: false,
66
+ print: false,
67
+ uninstall: false,
68
+ };
69
+ for (let i = 0; i < args.length; i++) {
70
+ switch (args[i]) {
71
+ case "--project-dir":
72
+ result.projectDir = args[++i];
73
+ break;
74
+ case "--global":
75
+ if (opts?.supportsGlobal)
76
+ result.global = true;
77
+ break;
78
+ case "--print":
79
+ result.print = true;
80
+ break;
81
+ case "--uninstall":
82
+ result.uninstall = true;
83
+ break;
84
+ }
85
+ }
86
+ return result;
87
+ }
88
+ // ─── JSON File I/O ─────────────────────────────────────────────────
89
+ /**
90
+ * Read and parse a JSON file. Returns empty object if file doesn't exist or is invalid.
91
+ */
92
+ function readJsonFile(filePath) {
93
+ if (!fs.existsSync(filePath))
94
+ return {};
95
+ try {
96
+ return JSON.parse(fs.readFileSync(filePath, "utf-8"));
97
+ }
98
+ catch {
99
+ return {};
100
+ }
101
+ }
102
+ /**
103
+ * Write a JSON file, creating parent directories if needed.
104
+ */
105
+ function writeJsonFile(filePath, data) {
106
+ const dir = path.dirname(filePath);
107
+ if (!fs.existsSync(dir)) {
108
+ fs.mkdirSync(dir, { recursive: true });
109
+ }
110
+ fs.writeFileSync(filePath, JSON.stringify(data, null, 2) + "\n");
111
+ }
112
+ // ─── Hook Command Utilities ────────────────────────────────────────
113
+ /**
114
+ * Check if a hook command belongs to an Ory plugin.
115
+ */
116
+ function isOryHookCommand(h, binName) {
117
+ return h.command?.includes(binName) || h.command?.includes("ory-agent-plugins");
118
+ }
119
+ /**
120
+ * Resolve the hook command string for a plugin.
121
+ * Tries require.resolve first, falls back to the global bin name.
122
+ */
123
+ function resolveHookCommand(packageName, binName) {
124
+ try {
125
+ const binPath = require.resolve(packageName);
126
+ // The package root resolves to the main entry (dist/index.js).
127
+ // The hook script lives alongside it as dist/hook.js.
128
+ const hookPath = path.resolve(path.dirname(binPath), "hook.js");
129
+ return `node ${hookPath}`;
130
+ }
131
+ catch {
132
+ return binName;
133
+ }
134
+ }
135
+ // ─── Matcher-Based Hooks (Claude Code, Gemini CLI) ─────────────────
136
+ /**
137
+ * Build a matcher-based hook entry: `[{ matcher: "", hooks: [{ type: "command", command }] }]`
138
+ */
139
+ function matcherHookEntry(cmd) {
140
+ return [{ matcher: "", hooks: [{ type: "command", command: cmd }] }];
141
+ }
142
+ /**
143
+ * Merge matcher-based hooks into existing settings, replacing any existing Ory entries.
144
+ */
145
+ function mergeMatcherHooks(existing, newHooks, binName) {
146
+ const merged = { ...existing };
147
+ const existingHooks = (merged.hooks ?? {});
148
+ for (const [event, entries] of Object.entries(newHooks)) {
149
+ const eventEntries = existingHooks[event] ?? [];
150
+ const filtered = eventEntries.filter((entry) => !entry.hooks?.some((h) => isOryHookCommand(h, binName)));
151
+ filtered.push(...entries);
152
+ existingHooks[event] = filtered;
153
+ }
154
+ merged.hooks = existingHooks;
155
+ return merged;
156
+ }
157
+ /**
158
+ * Remove all Ory matcher-based hooks from existing settings.
159
+ */
160
+ function removeMatcherHooks(existing, binName) {
161
+ const merged = { ...existing };
162
+ const hooks = (merged.hooks ?? {});
163
+ for (const event of Object.keys(hooks)) {
164
+ hooks[event] = hooks[event].filter((entry) => !entry.hooks?.some((h) => isOryHookCommand(h, binName)));
165
+ if (hooks[event].length === 0) {
166
+ delete hooks[event];
167
+ }
168
+ }
169
+ if (Object.keys(hooks).length === 0) {
170
+ delete merged.hooks;
171
+ }
172
+ else {
173
+ merged.hooks = hooks;
174
+ }
175
+ return merged;
176
+ }
177
+ // ─── Flat Hooks (Codex) ────────────────────────────────────────────
178
+ /**
179
+ * Build a flat hook entry: `[{ type: "command", command }]`
180
+ */
181
+ function flatHookEntry(cmd) {
182
+ return [{ type: "command", command: cmd }];
183
+ }
184
+ /**
185
+ * Merge flat hooks into existing config, replacing any existing Ory entries.
186
+ */
187
+ function mergeFlatHooks(existing, newHooks, binName) {
188
+ const merged = { ...existing };
189
+ const existingHooks = (merged.hooks ?? {});
190
+ for (const [event, entries] of Object.entries(newHooks)) {
191
+ const eventEntries = existingHooks[event] ?? [];
192
+ const filtered = eventEntries.filter((entry) => !isOryHookCommand(entry, binName));
193
+ filtered.push(...entries);
194
+ existingHooks[event] = filtered;
195
+ }
196
+ merged.hooks = existingHooks;
197
+ return merged;
198
+ }
199
+ /**
200
+ * Remove all Ory flat hooks from existing config.
201
+ */
202
+ function removeFlatHooks(existing, binName) {
203
+ const merged = { ...existing };
204
+ const hooks = (merged.hooks ?? {});
205
+ for (const event of Object.keys(hooks)) {
206
+ hooks[event] = hooks[event].filter((entry) => !isOryHookCommand(entry, binName));
207
+ if (hooks[event].length === 0) {
208
+ delete hooks[event];
209
+ }
210
+ }
211
+ if (Object.keys(hooks).length === 0) {
212
+ delete merged.hooks;
213
+ }
214
+ else {
215
+ merged.hooks = hooks;
216
+ }
217
+ return merged;
218
+ }
219
+ // ─── MCP Server Config ────────────────────────────────────────────
220
+ const MCP_SERVER_NAME = "ory";
221
+ const MCP_SERVER_PACKAGE = "@ory/mcp-server";
222
+ /**
223
+ * Resolve the command + args needed to run the Ory MCP server.
224
+ * Tries require.resolve first, falls back to the global bin name.
225
+ */
226
+ function resolveMcpServerCommand() {
227
+ try {
228
+ const entryPoint = require.resolve(MCP_SERVER_PACKAGE);
229
+ return { command: "node", args: [entryPoint] };
230
+ }
231
+ catch {
232
+ return { command: "ory-mcp-server", args: [] };
233
+ }
234
+ }
235
+ /**
236
+ * Generate the mcpServers config object for the Ory MCP server.
237
+ */
238
+ function mcpServerEntry(cmd) {
239
+ const resolved = cmd ?? resolveMcpServerCommand();
240
+ return {
241
+ command: resolved.command,
242
+ ...(resolved.args.length > 0 ? { args: resolved.args } : {}),
243
+ };
244
+ }
245
+ /**
246
+ * Merge the Ory MCP server into an existing settings object's `mcpServers` key.
247
+ * Pass an optional `cmd` to override the default resolution (useful when the
248
+ * caller can resolve the mcp-server entry point more reliably than core can).
249
+ */
250
+ function mergeMcpServer(existing, cmd) {
251
+ const merged = { ...existing };
252
+ const servers = (merged.mcpServers ?? {});
253
+ servers[MCP_SERVER_NAME] = mcpServerEntry(cmd);
254
+ merged.mcpServers = servers;
255
+ return merged;
256
+ }
257
+ /**
258
+ * Remove the Ory MCP server from an existing settings object's `mcpServers` key.
259
+ */
260
+ function removeMcpServer(existing) {
261
+ const merged = { ...existing };
262
+ const servers = (merged.mcpServers ?? {});
263
+ delete servers[MCP_SERVER_NAME];
264
+ if (Object.keys(servers).length === 0) {
265
+ delete merged.mcpServers;
266
+ }
267
+ else {
268
+ merged.mcpServers = servers;
269
+ }
270
+ return merged;
271
+ }
272
+ /**
273
+ * Get the path to the Claude Code plugins registry file.
274
+ */
275
+ function getPluginsRegistryPath() {
276
+ const home = process.env.HOME ?? process.env.USERPROFILE ?? "~";
277
+ return path.join(home, ".claude", "plugins", "installed_plugins.json");
278
+ }
279
+ /**
280
+ * Read the Claude Code plugins registry.
281
+ */
282
+ function readPluginsRegistry() {
283
+ const registryPath = getPluginsRegistryPath();
284
+ if (!fs.existsSync(registryPath)) {
285
+ return { version: 2, plugins: {} };
286
+ }
287
+ try {
288
+ const data = JSON.parse(fs.readFileSync(registryPath, "utf-8"));
289
+ return { version: data.version ?? 2, plugins: data.plugins ?? {} };
290
+ }
291
+ catch {
292
+ return { version: 2, plugins: {} };
293
+ }
294
+ }
295
+ /**
296
+ * Write the Claude Code plugins registry.
297
+ */
298
+ function writePluginsRegistry(registry) {
299
+ const registryPath = getPluginsRegistryPath();
300
+ const dir = path.dirname(registryPath);
301
+ if (!fs.existsSync(dir)) {
302
+ fs.mkdirSync(dir, { recursive: true });
303
+ }
304
+ fs.writeFileSync(registryPath, JSON.stringify(registry, null, 2) + "\n");
305
+ }
306
+ /**
307
+ * Register a plugin in the Claude Code plugins registry.
308
+ */
309
+ function registerPlugin(opts) {
310
+ const registry = readPluginsRegistry();
311
+ const key = `${opts.name}@inline`;
312
+ const now = new Date().toISOString();
313
+ const entry = {
314
+ scope: opts.scope,
315
+ installPath: opts.installPath,
316
+ version: opts.version,
317
+ installedAt: now,
318
+ lastUpdated: now,
319
+ };
320
+ if (opts.projectPath) {
321
+ entry.projectPath = opts.projectPath;
322
+ }
323
+ // Replace existing entry for the same scope/project, or add new
324
+ const existing = registry.plugins[key] ?? [];
325
+ const filtered = existing.filter((e) => {
326
+ if (opts.scope === "user")
327
+ return e.scope !== "user";
328
+ return !(e.scope === "project" && e.projectPath === opts.projectPath);
329
+ });
330
+ filtered.push(entry);
331
+ registry.plugins[key] = filtered;
332
+ writePluginsRegistry(registry);
333
+ }
334
+ /**
335
+ * Unregister a plugin from the Claude Code plugins registry.
336
+ */
337
+ function unregisterPlugin(opts) {
338
+ const registry = readPluginsRegistry();
339
+ const key = `${opts.name}@inline`;
340
+ const existing = registry.plugins[key];
341
+ if (!existing)
342
+ return;
343
+ const filtered = existing.filter((e) => {
344
+ if (opts.scope === "user")
345
+ return e.scope !== "user";
346
+ return !(e.scope === "project" && e.projectPath === opts.projectPath);
347
+ });
348
+ if (filtered.length === 0) {
349
+ delete registry.plugins[key];
350
+ }
351
+ else {
352
+ registry.plugins[key] = filtered;
353
+ }
354
+ writePluginsRegistry(registry);
355
+ }
356
+ // ─── Shared Output ─────────────────────────────────────────────────
357
+ /**
358
+ * Print the standard setup help text showing supported environment variables.
359
+ */
360
+ function printSetupHelp(binName, harnessName, opts) {
361
+ console.log(`
362
+ ${binName} — Configure Ory hooks for ${harnessName}
363
+
364
+ Usage:
365
+ npx ${binName} [options]
366
+
367
+ Options:
368
+ --project-dir <path> Project directory (default: cwd)${opts?.supportsGlobal ? `\n --global Install to ${opts.globalPath ?? "global config"} instead of project` : ""}
369
+ --print Print generated config to stdout without writing
370
+ --uninstall Remove Ory hooks from config
371
+ -h, --help Show this help
372
+
373
+ Environment variables:
374
+ ORY_PROJECT_URL Your Ory project URL (required at runtime)
375
+ ORY_API_KEY Ory API key (required at runtime)
376
+ ORY_SESSION_TOKEN Session token for agent authentication
377
+ ORY_AGENT_DEBUG Set to "true" for debug logging
378
+ ORY_AGENT_LOG_FILE Path to write debug logs
379
+ ORY_AGENT_SUBJECT_ID Override the subject ID for permission checks
380
+ `);
381
+ }
382
+ /**
383
+ * Print the "Next steps" text after successful setup.
384
+ */
385
+ function printNextSteps(harnessName, uninstallCmd) {
386
+ console.log("");
387
+ console.log("Next steps:");
388
+ console.log(" 1. Set required environment variables:");
389
+ console.log(" export ORY_PROJECT_URL=https://your-project.projects.oryapis.com");
390
+ console.log(" export ORY_API_KEY=ory_pat_...");
391
+ console.log("");
392
+ console.log(" 2. Optionally enable debug logging:");
393
+ console.log(" export ORY_AGENT_DEBUG=true");
394
+ console.log("");
395
+ console.log(` 3. Start ${harnessName} in your project directory.`);
396
+ console.log("");
397
+ console.log(`To uninstall: ${uninstallCmd}`);
398
+ }
@@ -0,0 +1,78 @@
1
+ /**
2
+ * Canonical Ory agent skills and commands.
3
+ *
4
+ * The skill playbooks (auth-setup, login-flow, social-login, local-dev) and the
5
+ * local-stack commands (local-up, local-down) live once, as token-bearing
6
+ * templates under `packages/core/assets/`. Every harness plugin renders them
7
+ * through {@link renderOrySkills} / {@link renderOryCommands}, substituting the
8
+ * harness's CLI binary, package name, and the way it references sibling skills
9
+ * and commands. Plugins then write the rendered docs into whatever location
10
+ * their harness discovers skills/commands from (a marketplace plugin dir, an
11
+ * extension bundle, `~/.codex/skills`, `.opencode/skills`, …).
12
+ *
13
+ * This keeps the ~1200 lines of guidance in one place — there is no per-harness
14
+ * copy to drift.
15
+ */
16
+ /** Names of the skills materialized by the plugins (for uninstall cleanup). */
17
+ export declare const ORY_SKILL_NAMES: readonly string[];
18
+ /** Skill names of the local-stack commands when rendered as skills. */
19
+ export declare const ORY_COMMAND_SKILL_NAMES: readonly string[];
20
+ /** File stems of the local-stack commands when rendered as commands. */
21
+ export declare const ORY_COMMAND_SLUGS: readonly string[];
22
+ export interface RenderedSkill {
23
+ /** Stable id, e.g. "auth-setup". */
24
+ id: string;
25
+ /** Skill name / frontmatter `name`, e.g. "ory-auth-setup". */
26
+ name: string;
27
+ /** One-line description (rendered). */
28
+ description: string;
29
+ /** Markdown body without frontmatter (rendered). */
30
+ body: string;
31
+ /** Full `SKILL.md` content: frontmatter + body (rendered). */
32
+ markdown: string;
33
+ }
34
+ export interface RenderedCommand {
35
+ /** Stable id, e.g. "local-up". */
36
+ id: string;
37
+ /** Skill-style name, e.g. "ory-local-up". */
38
+ name: string;
39
+ /** Command slug / file stem, e.g. "local-up". */
40
+ slug: string;
41
+ /** One-line description (rendered). */
42
+ description: string;
43
+ /** Markdown body (rendered). */
44
+ body: string;
45
+ }
46
+ export interface RenderProfileOptions {
47
+ /** CLI binary the harness exposes, e.g. "ory-codex". */
48
+ binName: string;
49
+ /** npm package name, e.g. "@ory/codex". */
50
+ packageName: string;
51
+ }
52
+ /**
53
+ * Render the four guide skills for a harness as `SKILL.md` documents.
54
+ */
55
+ export declare function renderOrySkills(harness: string, opts: RenderProfileOptions): RenderedSkill[];
56
+ /**
57
+ * Render the two local-stack commands for a harness. The `body` is the rendered
58
+ * markdown; callers format it into the harness's command shape (plain markdown,
59
+ * TOML, frontmatter markdown) or wrap it as a skill via {@link commandToSkill}.
60
+ */
61
+ export declare function renderOryCommands(harness: string, opts: RenderProfileOptions): RenderedCommand[];
62
+ /** Compose a `SKILL.md` from its parts. */
63
+ export declare function toSkillMarkdown(name: string, description: string, body: string): string;
64
+ /** Wrap a rendered command as a user-invocable skill (Codex, OpenClaw). */
65
+ export declare function commandToSkill(cmd: RenderedCommand): RenderedSkill;
66
+ /** Render a command as a Gemini CLI TOML command definition. */
67
+ export declare function commandToToml(cmd: RenderedCommand): string;
68
+ /** Render a command as an OpenCode markdown command (frontmatter + body). */
69
+ export declare function commandToFrontmatterMarkdown(cmd: RenderedCommand): string;
70
+ /** Render a command as a plain markdown command file (Claude Code). */
71
+ export declare function commandToPlainMarkdown(cmd: RenderedCommand): string;
72
+ /**
73
+ * Write each skill into `<skillsDir>/<name>/SKILL.md`. Overwrites existing
74
+ * files; creates directories as needed.
75
+ */
76
+ export declare function writeSkillTree(skillsDir: string, skills: RenderedSkill[]): void;
77
+ /** Remove the named skill directories from `skillsDir` (best-effort). */
78
+ export declare function removeSkillDirs(skillsDir: string, names: readonly string[]): void;