@autonav/core 1.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/README.md +115 -0
- package/dist/adapter/claude-adapter.d.ts +136 -0
- package/dist/adapter/claude-adapter.d.ts.map +1 -0
- package/dist/adapter/claude-adapter.js +340 -0
- package/dist/adapter/claude-adapter.js.map +1 -0
- package/dist/adapter/index.d.ts +7 -0
- package/dist/adapter/index.d.ts.map +1 -0
- package/dist/adapter/index.js +7 -0
- package/dist/adapter/index.js.map +1 -0
- package/dist/cli/autonav.d.ts +11 -0
- package/dist/cli/autonav.d.ts.map +1 -0
- package/dist/cli/autonav.js +79 -0
- package/dist/cli/autonav.js.map +1 -0
- package/dist/cli/nav-chat.d.ts +3 -0
- package/dist/cli/nav-chat.d.ts.map +1 -0
- package/dist/cli/nav-chat.js +151 -0
- package/dist/cli/nav-chat.js.map +1 -0
- package/dist/cli/nav-init.d.ts +3 -0
- package/dist/cli/nav-init.d.ts.map +1 -0
- package/dist/cli/nav-init.js +366 -0
- package/dist/cli/nav-init.js.map +1 -0
- package/dist/cli/nav-query.d.ts +3 -0
- package/dist/cli/nav-query.d.ts.map +1 -0
- package/dist/cli/nav-query.js +217 -0
- package/dist/cli/nav-query.js.map +1 -0
- package/dist/conversation/App.d.ts +14 -0
- package/dist/conversation/App.d.ts.map +1 -0
- package/dist/conversation/App.js +229 -0
- package/dist/conversation/App.js.map +1 -0
- package/dist/conversation/index.d.ts +29 -0
- package/dist/conversation/index.d.ts.map +1 -0
- package/dist/conversation/index.js +44 -0
- package/dist/conversation/index.js.map +1 -0
- package/dist/conversation/prompts.d.ts +9 -0
- package/dist/conversation/prompts.d.ts.map +1 -0
- package/dist/conversation/prompts.js +47 -0
- package/dist/conversation/prompts.js.map +1 -0
- package/dist/index.d.ts +13 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +24 -0
- package/dist/index.js.map +1 -0
- package/dist/interview/App.d.ts +14 -0
- package/dist/interview/App.d.ts.map +1 -0
- package/dist/interview/App.js +159 -0
- package/dist/interview/App.js.map +1 -0
- package/dist/interview/index.d.ts +30 -0
- package/dist/interview/index.d.ts.map +1 -0
- package/dist/interview/index.js +52 -0
- package/dist/interview/index.js.map +1 -0
- package/dist/interview/prompts.d.ts +36 -0
- package/dist/interview/prompts.d.ts.map +1 -0
- package/dist/interview/prompts.js +116 -0
- package/dist/interview/prompts.js.map +1 -0
- package/dist/pack-installer/github.d.ts +41 -0
- package/dist/pack-installer/github.d.ts.map +1 -0
- package/dist/pack-installer/github.js +294 -0
- package/dist/pack-installer/github.js.map +1 -0
- package/dist/pack-installer/index.d.ts +57 -0
- package/dist/pack-installer/index.d.ts.map +1 -0
- package/dist/pack-installer/index.js +257 -0
- package/dist/pack-installer/index.js.map +1 -0
- package/dist/plugins/config-schema.d.ts +32 -0
- package/dist/plugins/config-schema.d.ts.map +1 -0
- package/dist/plugins/config-schema.js +26 -0
- package/dist/plugins/config-schema.js.map +1 -0
- package/dist/plugins/implementations/file-watcher/index.d.ts +110 -0
- package/dist/plugins/implementations/file-watcher/index.d.ts.map +1 -0
- package/dist/plugins/implementations/file-watcher/index.js +212 -0
- package/dist/plugins/implementations/file-watcher/index.js.map +1 -0
- package/dist/plugins/implementations/github/index.d.ts +201 -0
- package/dist/plugins/implementations/github/index.d.ts.map +1 -0
- package/dist/plugins/implementations/github/index.js +337 -0
- package/dist/plugins/implementations/github/index.js.map +1 -0
- package/dist/plugins/implementations/slack/index.d.ts +153 -0
- package/dist/plugins/implementations/slack/index.d.ts.map +1 -0
- package/dist/plugins/implementations/slack/index.js +221 -0
- package/dist/plugins/implementations/slack/index.js.map +1 -0
- package/dist/plugins/index.d.ts +23 -0
- package/dist/plugins/index.d.ts.map +1 -0
- package/dist/plugins/index.js +35 -0
- package/dist/plugins/index.js.map +1 -0
- package/dist/plugins/plugin-manager.d.ts +66 -0
- package/dist/plugins/plugin-manager.d.ts.map +1 -0
- package/dist/plugins/plugin-manager.js +198 -0
- package/dist/plugins/plugin-manager.js.map +1 -0
- package/dist/plugins/types.d.ts +102 -0
- package/dist/plugins/types.d.ts.map +1 -0
- package/dist/plugins/types.js +38 -0
- package/dist/plugins/types.js.map +1 -0
- package/dist/plugins/utils/security.d.ts +43 -0
- package/dist/plugins/utils/security.d.ts.map +1 -0
- package/dist/plugins/utils/security.js +115 -0
- package/dist/plugins/utils/security.js.map +1 -0
- package/dist/query-engine/index.d.ts +10 -0
- package/dist/query-engine/index.d.ts.map +1 -0
- package/dist/query-engine/index.js +10 -0
- package/dist/query-engine/index.js.map +1 -0
- package/dist/query-engine/navigator-loader.d.ts +37 -0
- package/dist/query-engine/navigator-loader.d.ts.map +1 -0
- package/dist/query-engine/navigator-loader.js +167 -0
- package/dist/query-engine/navigator-loader.js.map +1 -0
- package/dist/query-engine/output-formatter.d.ts +55 -0
- package/dist/query-engine/output-formatter.d.ts.map +1 -0
- package/dist/query-engine/output-formatter.js +165 -0
- package/dist/query-engine/output-formatter.js.map +1 -0
- package/dist/query-engine/response-validator.d.ts +55 -0
- package/dist/query-engine/response-validator.d.ts.map +1 -0
- package/dist/query-engine/response-validator.js +92 -0
- package/dist/query-engine/response-validator.js.map +1 -0
- package/dist/templates/.gitignore.template +23 -0
- package/dist/templates/CLAUDE-pack.md.template +32 -0
- package/dist/templates/CLAUDE.md.template +128 -0
- package/dist/templates/README.md.template +174 -0
- package/dist/templates/config-pack.json.template +16 -0
- package/dist/templates/config.json.template +11 -0
- package/dist/templates/index.d.ts +22 -0
- package/dist/templates/index.d.ts.map +1 -0
- package/dist/templates/index.js +32 -0
- package/dist/templates/index.js.map +1 -0
- package/dist/templates/plugins.json.template +33 -0
- package/dist/templates/system-configuration.md.template +66 -0
- package/dist/tools/handler.d.ts +20 -0
- package/dist/tools/handler.d.ts.map +1 -0
- package/dist/tools/handler.js +202 -0
- package/dist/tools/handler.js.map +1 -0
- package/dist/tools/index.d.ts +10 -0
- package/dist/tools/index.d.ts.map +1 -0
- package/dist/tools/index.js +10 -0
- package/dist/tools/index.js.map +1 -0
- package/dist/tools/response.d.ts +30 -0
- package/dist/tools/response.d.ts.map +1 -0
- package/dist/tools/response.js +68 -0
- package/dist/tools/response.js.map +1 -0
- package/dist/tools/self-config.d.ts +54 -0
- package/dist/tools/self-config.d.ts.map +1 -0
- package/dist/tools/self-config.js +84 -0
- package/dist/tools/self-config.js.map +1 -0
- package/dist/validation/index.d.ts +19 -0
- package/dist/validation/index.d.ts.map +1 -0
- package/dist/validation/index.js +91 -0
- package/dist/validation/index.js.map +1 -0
- package/package.json +71 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Platform AI Autonav
|
|
3
|
+
*
|
|
4
|
+
* CLI tools and Claude SDK Adapter for building and querying navigators
|
|
5
|
+
*
|
|
6
|
+
* @packageDocumentation
|
|
7
|
+
*/
|
|
8
|
+
export { ClaudeAdapter, type ClaudeAdapterOptions, type LoadedNavigator, type QueryOptions, } from "./adapter/index.js";
|
|
9
|
+
export { createSelfConfigMcpServer, CONFIGURABLE_PLUGINS, processToolCall, handleUpdatePluginConfig, handleGetPluginConfig, type ConfigurablePlugin, type UpdatePluginConfigInput, type GetPluginConfigInput, type SelfConfigResult, } from "./tools/index.js";
|
|
10
|
+
export { loadTemplates, replaceTemplateVars, type Templates, } from "./templates/index.js";
|
|
11
|
+
export { type Plugin, type PluginHealthStatus, PluginError, PluginInitializationError, PluginListenError, PluginActionError, PluginConfigurationError, PluginManager, type PluginsConfig, createPluginManager, FileWatcherPlugin, SlackPlugin, GitHubPlugin, PluginConfigFileSchema, type PluginConfigFile, } from "./plugins/index.js";
|
|
12
|
+
export * from "./query-engine/index.js";
|
|
13
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,EACL,aAAa,EACb,KAAK,oBAAoB,EACzB,KAAK,eAAe,EACpB,KAAK,YAAY,GAClB,MAAM,oBAAoB,CAAC;AAG5B,OAAO,EACL,yBAAyB,EACzB,oBAAoB,EACpB,eAAe,EACf,wBAAwB,EACxB,qBAAqB,EACrB,KAAK,kBAAkB,EACvB,KAAK,uBAAuB,EAC5B,KAAK,oBAAoB,EACzB,KAAK,gBAAgB,GACtB,MAAM,kBAAkB,CAAC;AAG1B,OAAO,EACL,aAAa,EACb,mBAAmB,EACnB,KAAK,SAAS,GACf,MAAM,sBAAsB,CAAC;AAG9B,OAAO,EAEL,KAAK,MAAM,EACX,KAAK,kBAAkB,EACvB,WAAW,EACX,yBAAyB,EACzB,iBAAiB,EACjB,iBAAiB,EACjB,wBAAwB,EAExB,aAAa,EACb,KAAK,aAAa,EAClB,mBAAmB,EAEnB,iBAAiB,EACjB,WAAW,EACX,YAAY,EAEZ,sBAAsB,EACtB,KAAK,gBAAgB,GACtB,MAAM,oBAAoB,CAAC;AAG5B,cAAc,yBAAyB,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Platform AI Autonav
|
|
3
|
+
*
|
|
4
|
+
* CLI tools and Claude SDK Adapter for building and querying navigators
|
|
5
|
+
*
|
|
6
|
+
* @packageDocumentation
|
|
7
|
+
*/
|
|
8
|
+
// Export adapter
|
|
9
|
+
export { ClaudeAdapter, } from "./adapter/index.js";
|
|
10
|
+
// Export self-configuration tools
|
|
11
|
+
export { createSelfConfigMcpServer, CONFIGURABLE_PLUGINS, processToolCall, handleUpdatePluginConfig, handleGetPluginConfig, } from "./tools/index.js";
|
|
12
|
+
// Export templates utilities (for programmatic use)
|
|
13
|
+
export { loadTemplates, replaceTemplateVars, } from "./templates/index.js";
|
|
14
|
+
// Export plugin system
|
|
15
|
+
export { PluginError, PluginInitializationError, PluginListenError, PluginActionError, PluginConfigurationError,
|
|
16
|
+
// Plugin manager
|
|
17
|
+
PluginManager, createPluginManager,
|
|
18
|
+
// Plugin implementations
|
|
19
|
+
FileWatcherPlugin, SlackPlugin, GitHubPlugin,
|
|
20
|
+
// Configuration schema
|
|
21
|
+
PluginConfigFileSchema, } from "./plugins/index.js";
|
|
22
|
+
// Export query engine
|
|
23
|
+
export * from "./query-engine/index.js";
|
|
24
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,iBAAiB;AACjB,OAAO,EACL,aAAa,GAId,MAAM,oBAAoB,CAAC;AAE5B,kCAAkC;AAClC,OAAO,EACL,yBAAyB,EACzB,oBAAoB,EACpB,eAAe,EACf,wBAAwB,EACxB,qBAAqB,GAKtB,MAAM,kBAAkB,CAAC;AAE1B,oDAAoD;AACpD,OAAO,EACL,aAAa,EACb,mBAAmB,GAEpB,MAAM,sBAAsB,CAAC;AAE9B,uBAAuB;AACvB,OAAO,EAIL,WAAW,EACX,yBAAyB,EACzB,iBAAiB,EACjB,iBAAiB,EACjB,wBAAwB;AACxB,iBAAiB;AACjB,aAAa,EAEb,mBAAmB;AACnB,yBAAyB;AACzB,iBAAiB,EACjB,WAAW,EACX,YAAY;AACZ,uBAAuB;AACvB,sBAAsB,GAEvB,MAAM,oBAAoB,CAAC;AAE5B,sBAAsB;AACtB,cAAc,yBAAyB,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Ink-based TUI for interactive nav init interview
|
|
3
|
+
*
|
|
4
|
+
* Uses Claude Agent SDK for authentication (leverages Claude Code's OAuth)
|
|
5
|
+
*/
|
|
6
|
+
import { type NavigatorConfig, type PackContext } from "./prompts.js";
|
|
7
|
+
interface InterviewAppProps {
|
|
8
|
+
name: string;
|
|
9
|
+
packContext?: PackContext;
|
|
10
|
+
onComplete: (config: NavigatorConfig) => void;
|
|
11
|
+
}
|
|
12
|
+
export declare function InterviewApp({ name, packContext, onComplete }: InterviewAppProps): import("react/jsx-runtime").JSX.Element;
|
|
13
|
+
export {};
|
|
14
|
+
//# sourceMappingURL=App.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"App.d.ts","sourceRoot":"","sources":["../../src/interview/App.tsx"],"names":[],"mappings":"AAAA;;;;GAIG;AAMH,OAAO,EAGL,KAAK,eAAe,EACpB,KAAK,WAAW,EACjB,MAAM,cAAc,CAAC;AAmBtB,UAAU,iBAAiB;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,WAAW,CAAC;IAC1B,UAAU,EAAE,CAAC,MAAM,EAAE,eAAe,KAAK,IAAI,CAAC;CAC/C;AAED,wBAAgB,YAAY,CAAC,EAAE,IAAI,EAAE,WAAW,EAAE,UAAU,EAAE,EAAE,iBAAiB,2CA4NhF"}
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
/**
|
|
3
|
+
* Ink-based TUI for interactive nav init interview
|
|
4
|
+
*
|
|
5
|
+
* Uses Claude Agent SDK for authentication (leverages Claude Code's OAuth)
|
|
6
|
+
*/
|
|
7
|
+
import { useState, useEffect, useCallback, useRef } from "react";
|
|
8
|
+
import { Box, Text, useApp, useInput } from "ink";
|
|
9
|
+
import TextInput from "ink-text-input";
|
|
10
|
+
import { query } from "@anthropic-ai/claude-agent-sdk";
|
|
11
|
+
import { getInterviewSystemPrompt, parseNavigatorConfig, } from "./prompts.js";
|
|
12
|
+
// Check if debug mode is enabled
|
|
13
|
+
const DEBUG = process.env.AUTONAV_DEBUG === "1" || process.env.DEBUG === "1";
|
|
14
|
+
// Model to use for interview
|
|
15
|
+
const INTERVIEW_MODEL = "claude-sonnet-4-5";
|
|
16
|
+
function debugLog(...args) {
|
|
17
|
+
if (DEBUG) {
|
|
18
|
+
console.error("[DEBUG]", ...args);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
export function InterviewApp({ name, packContext, onComplete }) {
|
|
22
|
+
// Get the system prompt, customized for pack if provided
|
|
23
|
+
const systemPrompt = getInterviewSystemPrompt(packContext);
|
|
24
|
+
const [messages, setMessages] = useState([]);
|
|
25
|
+
const [input, setInput] = useState("");
|
|
26
|
+
const [isLoading, setIsLoading] = useState(true);
|
|
27
|
+
const [error, setError] = useState(null);
|
|
28
|
+
const queryRef = useRef(null);
|
|
29
|
+
const completedRef = useRef(false);
|
|
30
|
+
const { exit } = useApp();
|
|
31
|
+
// Process messages from Claude
|
|
32
|
+
const processResponse = useCallback(async () => {
|
|
33
|
+
const queryInstance = queryRef.current;
|
|
34
|
+
if (!queryInstance || completedRef.current)
|
|
35
|
+
return;
|
|
36
|
+
try {
|
|
37
|
+
debugLog("Waiting for Claude response...");
|
|
38
|
+
let fullText = "";
|
|
39
|
+
for await (const message of queryInstance) {
|
|
40
|
+
debugLog("Received message type:", message.type);
|
|
41
|
+
if (message.type === "assistant") {
|
|
42
|
+
// Extract text content from the assistant message
|
|
43
|
+
const content = message.message.content;
|
|
44
|
+
const textBlocks = content.filter((b) => b.type === "text");
|
|
45
|
+
const text = textBlocks.map((b) => b.text).join("\n");
|
|
46
|
+
if (text) {
|
|
47
|
+
fullText = text;
|
|
48
|
+
setMessages((prev) => [
|
|
49
|
+
...prev,
|
|
50
|
+
{ role: "assistant", content: text },
|
|
51
|
+
]);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
else if (message.type === "result") {
|
|
55
|
+
debugLog("Result received:", message.subtype);
|
|
56
|
+
// Query completed, check if we got a config
|
|
57
|
+
break;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
// Check if the response contains a navigator config
|
|
61
|
+
if (fullText) {
|
|
62
|
+
const config = parseNavigatorConfig(fullText);
|
|
63
|
+
if (config) {
|
|
64
|
+
debugLog("Interview complete, config parsed");
|
|
65
|
+
completedRef.current = true;
|
|
66
|
+
onComplete(config);
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
setIsLoading(false);
|
|
71
|
+
}
|
|
72
|
+
catch (err) {
|
|
73
|
+
debugLog("Error processing response:", err);
|
|
74
|
+
setError(err instanceof Error ? err.message : "Error communicating with Claude");
|
|
75
|
+
setIsLoading(false);
|
|
76
|
+
}
|
|
77
|
+
}, [onComplete]);
|
|
78
|
+
// Initialize query and send first message
|
|
79
|
+
useEffect(() => {
|
|
80
|
+
const initQuery = async () => {
|
|
81
|
+
try {
|
|
82
|
+
debugLog("Creating query with model:", INTERVIEW_MODEL);
|
|
83
|
+
// Create initial prompt
|
|
84
|
+
const initialMessage = `I want to create a navigator called "${name}".`;
|
|
85
|
+
debugLog("Initial message:", initialMessage);
|
|
86
|
+
// Create query with system prompt
|
|
87
|
+
const queryInstance = query({
|
|
88
|
+
prompt: initialMessage,
|
|
89
|
+
options: {
|
|
90
|
+
model: INTERVIEW_MODEL,
|
|
91
|
+
systemPrompt,
|
|
92
|
+
permissionMode: "bypassPermissions",
|
|
93
|
+
},
|
|
94
|
+
});
|
|
95
|
+
queryRef.current = queryInstance;
|
|
96
|
+
debugLog("Query created");
|
|
97
|
+
// Process response
|
|
98
|
+
await processResponse();
|
|
99
|
+
}
|
|
100
|
+
catch (err) {
|
|
101
|
+
debugLog("Query initialization error:", err);
|
|
102
|
+
setError(err instanceof Error
|
|
103
|
+
? err.message
|
|
104
|
+
: "Failed to initialize Claude query");
|
|
105
|
+
setIsLoading(false);
|
|
106
|
+
}
|
|
107
|
+
};
|
|
108
|
+
initQuery();
|
|
109
|
+
}, [name, processResponse]);
|
|
110
|
+
// Handle user input submission
|
|
111
|
+
const handleSubmit = useCallback(async (value) => {
|
|
112
|
+
if (!value.trim() || isLoading || completedRef.current)
|
|
113
|
+
return;
|
|
114
|
+
setInput("");
|
|
115
|
+
setMessages((prev) => [...prev, { role: "user", content: value }]);
|
|
116
|
+
setIsLoading(true);
|
|
117
|
+
try {
|
|
118
|
+
debugLog("Sending user message:", value);
|
|
119
|
+
// Create a new query for each turn
|
|
120
|
+
// Include conversation history in the prompt with clear separation
|
|
121
|
+
const conversationHistory = messages
|
|
122
|
+
.map((m) => `<${m.role}>\n${m.content}\n</${m.role}>`)
|
|
123
|
+
.join("\n\n");
|
|
124
|
+
const fullPrompt = `<conversation_history>
|
|
125
|
+
${conversationHistory}
|
|
126
|
+
</conversation_history>
|
|
127
|
+
|
|
128
|
+
The user just responded with:
|
|
129
|
+
<user_message>
|
|
130
|
+
${value}
|
|
131
|
+
</user_message>
|
|
132
|
+
|
|
133
|
+
Continue the interview by responding to their message. Ask your next question OR if you have enough information, output the JSON configuration. Do NOT simulate user responses - only provide YOUR response as the assistant.`;
|
|
134
|
+
const queryInstance = query({
|
|
135
|
+
prompt: fullPrompt,
|
|
136
|
+
options: {
|
|
137
|
+
model: INTERVIEW_MODEL,
|
|
138
|
+
systemPrompt,
|
|
139
|
+
permissionMode: "bypassPermissions",
|
|
140
|
+
},
|
|
141
|
+
});
|
|
142
|
+
queryRef.current = queryInstance;
|
|
143
|
+
await processResponse();
|
|
144
|
+
}
|
|
145
|
+
catch (err) {
|
|
146
|
+
debugLog("Error sending message:", err);
|
|
147
|
+
setError(err instanceof Error ? err.message : "Failed to send message");
|
|
148
|
+
setIsLoading(false);
|
|
149
|
+
}
|
|
150
|
+
}, [isLoading, messages, processResponse]);
|
|
151
|
+
// Handle Ctrl+C to exit
|
|
152
|
+
useInput((input, key) => {
|
|
153
|
+
if (key.ctrl && input === "c") {
|
|
154
|
+
exit();
|
|
155
|
+
}
|
|
156
|
+
});
|
|
157
|
+
return (_jsxs(Box, { flexDirection: "column", padding: 1, children: [_jsx(Box, { marginBottom: 1, children: _jsxs(Text, { bold: true, color: "cyan", children: ["\uD83E\uDDED Creating navigator: ", name] }) }), _jsx(Box, { marginBottom: 1, children: _jsx(Text, { color: "gray", children: "Answer the questions below. Press Ctrl+C to cancel." }) }), messages.map((msg, i) => (_jsx(Box, { marginBottom: 1, flexDirection: "column", children: msg.role === "user" ? (_jsxs(Box, { children: [_jsx(Text, { color: "green", children: "› " }), _jsx(Text, { children: msg.content })] })) : (_jsx(Box, { children: _jsx(Text, { color: "white", children: msg.content }) })) }, i))), error && (_jsx(Box, { marginBottom: 1, children: _jsxs(Text, { color: "red", children: ["Error: ", error] }) })), isLoading && (_jsx(Box, { marginBottom: 1, children: _jsx(Text, { color: "gray", children: "Thinking..." }) })), !isLoading && !error && (_jsxs(Box, { children: [_jsx(Text, { color: "green", children: "› " }), _jsx(TextInput, { value: input, onChange: setInput, onSubmit: handleSubmit, placeholder: "Type your response..." })] }))] }));
|
|
158
|
+
}
|
|
159
|
+
//# sourceMappingURL=App.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"App.js","sourceRoot":"","sources":["../../src/interview/App.tsx"],"names":[],"mappings":";AAAA;;;;GAIG;AAEH,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AACjE,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,KAAK,CAAC;AAClD,OAAO,SAAS,MAAM,gBAAgB,CAAC;AACvC,OAAO,EAAE,KAAK,EAAc,MAAM,gCAAgC,CAAC;AACnE,OAAO,EACL,wBAAwB,EACxB,oBAAoB,GAGrB,MAAM,cAAc,CAAC;AAEtB,iCAAiC;AACjC,MAAM,KAAK,GAAG,OAAO,CAAC,GAAG,CAAC,aAAa,KAAK,GAAG,IAAI,OAAO,CAAC,GAAG,CAAC,KAAK,KAAK,GAAG,CAAC;AAE7E,6BAA6B;AAC7B,MAAM,eAAe,GAAG,mBAAmB,CAAC;AAE5C,SAAS,QAAQ,CAAC,GAAG,IAAe;IAClC,IAAI,KAAK,EAAE,CAAC;QACV,OAAO,CAAC,KAAK,CAAC,SAAS,EAAE,GAAG,IAAI,CAAC,CAAC;IACpC,CAAC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E,KAAK,EACZ,QAAQ,EAAE,QAAQ,EAClB,QAAQ,EAAE,YAAY,EACtB,WAAW,EAAC,uBAAuB,GACnC,IACE,CACP,IACG,CACP,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Interview module for interactive nav init
|
|
3
|
+
*
|
|
4
|
+
* Exports the runInterviewTUI function which launches an Ink-based
|
|
5
|
+
* conversational interface for creating navigators.
|
|
6
|
+
*/
|
|
7
|
+
import type { NavigatorConfig, PackContext } from "./prompts.js";
|
|
8
|
+
export type { NavigatorConfig, PackContext } from "./prompts.js";
|
|
9
|
+
export { getInterviewSystemPrompt } from "./prompts.js";
|
|
10
|
+
/**
|
|
11
|
+
* Options for the interview TUI
|
|
12
|
+
*/
|
|
13
|
+
export interface InterviewOptions {
|
|
14
|
+
/** Optional pack context to customize the interview */
|
|
15
|
+
packContext?: PackContext;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Check if the current environment supports interactive TTY input
|
|
19
|
+
*/
|
|
20
|
+
export declare function isInteractiveTerminal(): boolean;
|
|
21
|
+
/**
|
|
22
|
+
* Run the interactive interview TUI
|
|
23
|
+
*
|
|
24
|
+
* @param name - Name of the navigator to create
|
|
25
|
+
* @param options - Optional interview options (pack context, etc.)
|
|
26
|
+
* @returns Promise that resolves with the navigator configuration
|
|
27
|
+
* @throws Error if terminal doesn't support interactive mode
|
|
28
|
+
*/
|
|
29
|
+
export declare function runInterviewTUI(name: string, options?: InterviewOptions): Promise<NavigatorConfig>;
|
|
30
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/interview/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAKH,OAAO,KAAK,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAEjE,YAAY,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AACjE,OAAO,EAAE,wBAAwB,EAAE,MAAM,cAAc,CAAC;AAExD;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,uDAAuD;IACvD,WAAW,CAAC,EAAE,WAAW,CAAC;CAC3B;AAED;;GAEG;AACH,wBAAgB,qBAAqB,IAAI,OAAO,CAM/C;AAED;;;;;;;GAOG;AACH,wBAAgB,eAAe,CAC7B,IAAI,EAAE,MAAM,EACZ,OAAO,CAAC,EAAE,gBAAgB,GACzB,OAAO,CAAC,eAAe,CAAC,CAgC1B"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Interview module for interactive nav init
|
|
3
|
+
*
|
|
4
|
+
* Exports the runInterviewTUI function which launches an Ink-based
|
|
5
|
+
* conversational interface for creating navigators.
|
|
6
|
+
*/
|
|
7
|
+
import React from "react";
|
|
8
|
+
import { render } from "ink";
|
|
9
|
+
import { InterviewApp } from "./App.js";
|
|
10
|
+
export { getInterviewSystemPrompt } from "./prompts.js";
|
|
11
|
+
/**
|
|
12
|
+
* Check if the current environment supports interactive TTY input
|
|
13
|
+
*/
|
|
14
|
+
export function isInteractiveTerminal() {
|
|
15
|
+
return Boolean(process.stdin.isTTY &&
|
|
16
|
+
process.stdout.isTTY &&
|
|
17
|
+
process.stdin.setRawMode);
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Run the interactive interview TUI
|
|
21
|
+
*
|
|
22
|
+
* @param name - Name of the navigator to create
|
|
23
|
+
* @param options - Optional interview options (pack context, etc.)
|
|
24
|
+
* @returns Promise that resolves with the navigator configuration
|
|
25
|
+
* @throws Error if terminal doesn't support interactive mode
|
|
26
|
+
*/
|
|
27
|
+
export function runInterviewTUI(name, options) {
|
|
28
|
+
// Check for TTY support before attempting to render
|
|
29
|
+
if (!isInteractiveTerminal()) {
|
|
30
|
+
return Promise.reject(new Error("Interactive interview requires a TTY terminal. Use --quick to skip the interview."));
|
|
31
|
+
}
|
|
32
|
+
return new Promise((resolve, reject) => {
|
|
33
|
+
let completed = false;
|
|
34
|
+
const handleComplete = (config) => {
|
|
35
|
+
completed = true;
|
|
36
|
+
instance.unmount();
|
|
37
|
+
resolve(config);
|
|
38
|
+
};
|
|
39
|
+
const instance = render(React.createElement(InterviewApp, {
|
|
40
|
+
name,
|
|
41
|
+
packContext: options?.packContext,
|
|
42
|
+
onComplete: handleComplete,
|
|
43
|
+
}));
|
|
44
|
+
// Handle unmount without completion (user cancelled)
|
|
45
|
+
instance.waitUntilExit().then(() => {
|
|
46
|
+
if (!completed) {
|
|
47
|
+
reject(new Error("Interview cancelled by user"));
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/interview/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,MAAM,EAAE,MAAM,KAAK,CAAC;AAC7B,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAIxC,OAAO,EAAE,wBAAwB,EAAE,MAAM,cAAc,CAAC;AAUxD;;GAEG;AACH,MAAM,UAAU,qBAAqB;IACnC,OAAO,OAAO,CACZ,OAAO,CAAC,KAAK,CAAC,KAAK;QACnB,OAAO,CAAC,MAAM,CAAC,KAAK;QACpB,OAAO,CAAC,KAAK,CAAC,UAAU,CACzB,CAAC;AACJ,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,eAAe,CAC7B,IAAY,EACZ,OAA0B;IAE1B,oDAAoD;IACpD,IAAI,CAAC,qBAAqB,EAAE,EAAE,CAAC;QAC7B,OAAO,OAAO,CAAC,MAAM,CAAC,IAAI,KAAK,CAC7B,mFAAmF,CACpF,CAAC,CAAC;IACL,CAAC;IAED,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QACrC,IAAI,SAAS,GAAG,KAAK,CAAC;QAEtB,MAAM,cAAc,GAAG,CAAC,MAAuB,EAAE,EAAE;YACjD,SAAS,GAAG,IAAI,CAAC;YACjB,QAAQ,CAAC,OAAO,EAAE,CAAC;YACnB,OAAO,CAAC,MAAM,CAAC,CAAC;QAClB,CAAC,CAAC;QAEF,MAAM,QAAQ,GAAG,MAAM,CACrB,KAAK,CAAC,aAAa,CAAC,YAAY,EAAE;YAChC,IAAI;YACJ,WAAW,EAAE,OAAO,EAAE,WAAW;YACjC,UAAU,EAAE,cAAc;SAC3B,CAAC,CACH,CAAC;QAEF,qDAAqD;QACrD,QAAQ,CAAC,aAAa,EAAE,CAAC,IAAI,CAAC,GAAG,EAAE;YACjC,IAAI,CAAC,SAAS,EAAE,CAAC;gBACf,MAAM,CAAC,IAAI,KAAK,CAAC,6BAA6B,CAAC,CAAC,CAAC;YACnD,CAAC;QACH,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Interview prompts and tool definitions for interactive nav init
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Context for pack-based interviews
|
|
6
|
+
*/
|
|
7
|
+
export interface PackContext {
|
|
8
|
+
packName: string;
|
|
9
|
+
packVersion: string;
|
|
10
|
+
initGuide?: string;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Get the interview system prompt, optionally customized for a pack
|
|
14
|
+
*/
|
|
15
|
+
export declare function getInterviewSystemPrompt(packContext?: PackContext): string;
|
|
16
|
+
/**
|
|
17
|
+
* Legacy export for backwards compatibility
|
|
18
|
+
*/
|
|
19
|
+
export declare const INTERVIEW_SYSTEM_PROMPT = "You are helping create a new Autonav navigator - a self-organizing knowledge assistant.\n\n## Your Role\nGuide the user through understanding their needs so you can create a well-configured navigator. Ask questions naturally, one at a time. Listen carefully and ask follow-up questions when needed.\n\n## Key Topics to Explore\n\n1. **Purpose**: What is this navigator for? What problems will it solve?\n2. **Scope**: What topics should it know about? What's explicitly out of scope?\n3. **Knowledge Structure**: How should knowledge be organized? (by topic, project, chronologically, as a journal, etc.)\n4. **Knowledge Sources**: What documentation will be added? How should new knowledge be captured over time?\n5. **Audience**: Who will use this? How should it communicate? (formal, casual, technical depth)\n6. **Autonomy**: How autonomous should it be? Should it create/modify files freely, or ask first?\n\n## Philosophy\nNavs are \"self-organizing notebooks that talk back\" - they edit their own knowledge files, learn from conversations, and maintain their own context. Help the user think through how they want this self-organization to work.\n\n## Guidelines\n- Ask ONE question at a time\n- Be conversational and helpful\n- Ask follow-up questions when answers are vague\n- After gathering enough information (usually 4-6 exchanges), output the navigator configuration\n\n## When Creating the Navigator\nAfter gathering enough information, output a JSON configuration block wrapped in ```json and ``` markers. The JSON must include:\n\n```json\n{\n \"purpose\": \"One-sentence description of what this navigator is for\",\n \"scope\": \"Topics in scope and explicitly out of scope\",\n \"knowledgeStructure\": \"How knowledge should be organized (by topic, chronologically, by project, etc.)\",\n \"audience\": \"Who uses this navigator and how it should communicate\",\n \"autonomy\": \"Autonomy level - can it create files freely or should it ask first\",\n \"claudeMd\": \"The complete CLAUDE.md content as a string with proper newlines (\\n)\",\n \"suggestedDirectories\": [\"optional\", \"array\", \"of\", \"subdirectories\"]\n}\n```\n\nThe claudeMd field should be a complete, personalized CLAUDE.md file based on what you learned, including:\n- Clear purpose statement\n- Grounding rules (always cite, never invent, acknowledge uncertainty)\n- Domain-specific scope definition\n- Knowledge organization guidance\n- Response format expectations\n- Self-organization rules based on their autonomy preference\n\nIMPORTANT: Only output the JSON configuration when you have gathered enough information. Before that, just ask questions conversationally.";
|
|
20
|
+
/**
|
|
21
|
+
* Type for the navigator configuration from the interview
|
|
22
|
+
*/
|
|
23
|
+
export interface NavigatorConfig {
|
|
24
|
+
purpose: string;
|
|
25
|
+
scope: string;
|
|
26
|
+
knowledgeStructure?: string;
|
|
27
|
+
audience?: string;
|
|
28
|
+
autonomy?: string;
|
|
29
|
+
claudeMd: string;
|
|
30
|
+
suggestedDirectories?: string[];
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Parse a JSON configuration from the assistant's response
|
|
34
|
+
*/
|
|
35
|
+
export declare function parseNavigatorConfig(text: string): NavigatorConfig | null;
|
|
36
|
+
//# sourceMappingURL=prompts.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prompts.d.ts","sourceRoot":"","sources":["../../src/interview/prompts.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAqDD;;GAEG;AACH,wBAAgB,wBAAwB,CAAC,WAAW,CAAC,EAAE,WAAW,GAAG,MAAM,CAmC1E;AAED;;GAEG;AACH,eAAO,MAAM,uBAAuB,unFAAwB,CAAC;AAE7D;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,oBAAoB,CAAC,EAAE,MAAM,EAAE,CAAC;CACjC;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,MAAM,GAAG,eAAe,GAAG,IAAI,CAmBzE"}
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Interview prompts and tool definitions for interactive nav init
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Base system prompt for the nav creation interview
|
|
6
|
+
*/
|
|
7
|
+
const BASE_INTERVIEW_PROMPT = `You are helping create a new Autonav navigator - a self-organizing knowledge assistant.
|
|
8
|
+
|
|
9
|
+
## Your Role
|
|
10
|
+
Guide the user through understanding their needs so you can create a well-configured navigator. Ask questions naturally, one at a time. Listen carefully and ask follow-up questions when needed.
|
|
11
|
+
|
|
12
|
+
## Key Topics to Explore
|
|
13
|
+
|
|
14
|
+
1. **Purpose**: What is this navigator for? What problems will it solve?
|
|
15
|
+
2. **Scope**: What topics should it know about? What's explicitly out of scope?
|
|
16
|
+
3. **Knowledge Structure**: How should knowledge be organized? (by topic, project, chronologically, as a journal, etc.)
|
|
17
|
+
4. **Knowledge Sources**: What documentation will be added? How should new knowledge be captured over time?
|
|
18
|
+
5. **Audience**: Who will use this? How should it communicate? (formal, casual, technical depth)
|
|
19
|
+
6. **Autonomy**: How autonomous should it be? Should it create/modify files freely, or ask first?
|
|
20
|
+
|
|
21
|
+
## Philosophy
|
|
22
|
+
Navs are "self-organizing notebooks that talk back" - they edit their own knowledge files, learn from conversations, and maintain their own context. Help the user think through how they want this self-organization to work.
|
|
23
|
+
|
|
24
|
+
## Guidelines
|
|
25
|
+
- Ask ONE question at a time
|
|
26
|
+
- Be conversational and helpful
|
|
27
|
+
- Ask follow-up questions when answers are vague
|
|
28
|
+
- After gathering enough information (usually 4-6 exchanges), output the navigator configuration
|
|
29
|
+
|
|
30
|
+
## When Creating the Navigator
|
|
31
|
+
After gathering enough information, output a JSON configuration block wrapped in \`\`\`json and \`\`\` markers. The JSON must include:
|
|
32
|
+
|
|
33
|
+
\`\`\`json
|
|
34
|
+
{
|
|
35
|
+
"purpose": "One-sentence description of what this navigator is for",
|
|
36
|
+
"scope": "Topics in scope and explicitly out of scope",
|
|
37
|
+
"knowledgeStructure": "How knowledge should be organized (by topic, chronologically, by project, etc.)",
|
|
38
|
+
"audience": "Who uses this navigator and how it should communicate",
|
|
39
|
+
"autonomy": "Autonomy level - can it create files freely or should it ask first",
|
|
40
|
+
"claudeMd": "The complete CLAUDE.md content as a string with proper newlines (\\n)",
|
|
41
|
+
"suggestedDirectories": ["optional", "array", "of", "subdirectories"]
|
|
42
|
+
}
|
|
43
|
+
\`\`\`
|
|
44
|
+
|
|
45
|
+
The claudeMd field should be a complete, personalized CLAUDE.md file based on what you learned, including:
|
|
46
|
+
- Clear purpose statement
|
|
47
|
+
- Grounding rules (always cite, never invent, acknowledge uncertainty)
|
|
48
|
+
- Domain-specific scope definition
|
|
49
|
+
- Knowledge organization guidance
|
|
50
|
+
- Response format expectations
|
|
51
|
+
- Self-organization rules based on their autonomy preference
|
|
52
|
+
|
|
53
|
+
IMPORTANT: Only output the JSON configuration when you have gathered enough information. Before that, just ask questions conversationally.`;
|
|
54
|
+
/**
|
|
55
|
+
* Get the interview system prompt, optionally customized for a pack
|
|
56
|
+
*/
|
|
57
|
+
export function getInterviewSystemPrompt(packContext) {
|
|
58
|
+
if (!packContext) {
|
|
59
|
+
return BASE_INTERVIEW_PROMPT;
|
|
60
|
+
}
|
|
61
|
+
let packSection = `
|
|
62
|
+
## Knowledge Pack Context
|
|
63
|
+
|
|
64
|
+
This navigator is being created with the **${packContext.packName}** knowledge pack (v${packContext.packVersion}).
|
|
65
|
+
The pack provides pre-built knowledge and configuration for a specific domain.
|
|
66
|
+
`;
|
|
67
|
+
if (packContext.initGuide) {
|
|
68
|
+
packSection += `
|
|
69
|
+
## Pack Interview Guide (from INIT.md)
|
|
70
|
+
|
|
71
|
+
The pack author has provided the following guidance for this interview:
|
|
72
|
+
|
|
73
|
+
---
|
|
74
|
+
${packContext.initGuide}
|
|
75
|
+
---
|
|
76
|
+
|
|
77
|
+
Use this guidance to inform your questions and the navigator configuration. The pack's INIT.md takes precedence over the default topics - focus on what the pack author wants to capture during setup.
|
|
78
|
+
`;
|
|
79
|
+
}
|
|
80
|
+
else {
|
|
81
|
+
packSection += `
|
|
82
|
+
Since this pack provides domain knowledge, you can focus more on:
|
|
83
|
+
- How the user will use this specific domain knowledge
|
|
84
|
+
- Their experience level with the domain
|
|
85
|
+
- Specific customizations or preferences
|
|
86
|
+
- How autonomous the navigator should be with the pack's knowledge
|
|
87
|
+
`;
|
|
88
|
+
}
|
|
89
|
+
return BASE_INTERVIEW_PROMPT + packSection;
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Legacy export for backwards compatibility
|
|
93
|
+
*/
|
|
94
|
+
export const INTERVIEW_SYSTEM_PROMPT = BASE_INTERVIEW_PROMPT;
|
|
95
|
+
/**
|
|
96
|
+
* Parse a JSON configuration from the assistant's response
|
|
97
|
+
*/
|
|
98
|
+
export function parseNavigatorConfig(text) {
|
|
99
|
+
// Look for JSON code block
|
|
100
|
+
const jsonMatch = text.match(/```json\s*([\s\S]*?)```/);
|
|
101
|
+
if (!jsonMatch || !jsonMatch[1]) {
|
|
102
|
+
return null;
|
|
103
|
+
}
|
|
104
|
+
try {
|
|
105
|
+
const config = JSON.parse(jsonMatch[1].trim());
|
|
106
|
+
// Validate required fields
|
|
107
|
+
if (!config.purpose || !config.scope || !config.claudeMd) {
|
|
108
|
+
return null;
|
|
109
|
+
}
|
|
110
|
+
return config;
|
|
111
|
+
}
|
|
112
|
+
catch {
|
|
113
|
+
return null;
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
//# sourceMappingURL=prompts.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prompts.js","sourceRoot":"","sources":["../../src/interview/prompts.ts"],"names":[],"mappings":"AAAA;;GAEG;AAWH;;GAEG;AACH,MAAM,qBAAqB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2IA8C6G,CAAC;AAE5I;;GAEG;AACH,MAAM,UAAU,wBAAwB,CAAC,WAAyB;IAChE,IAAI,CAAC,WAAW,EAAE,CAAC;QACjB,OAAO,qBAAqB,CAAC;IAC/B,CAAC;IAED,IAAI,WAAW,GAAG;;;6CAGyB,WAAW,CAAC,QAAQ,uBAAuB,WAAW,CAAC,WAAW;;CAE9G,CAAC;IAEA,IAAI,WAAW,CAAC,SAAS,EAAE,CAAC;QAC1B,WAAW,IAAI;;;;;;EAMjB,WAAW,CAAC,SAAS;;;;CAItB,CAAC;IACA,CAAC;SAAM,CAAC;QACN,WAAW,IAAI;;;;;;CAMlB,CAAC;IACA,CAAC;IAED,OAAO,qBAAqB,GAAG,WAAW,CAAC;AAC7C,CAAC;AAED;;GAEG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG,qBAAqB,CAAC;AAe7D;;GAEG;AACH,MAAM,UAAU,oBAAoB,CAAC,IAAY;IAC/C,2BAA2B;IAC3B,MAAM,SAAS,GAAG,IAAI,CAAC,KAAK,CAAC,yBAAyB,CAAC,CAAC;IACxD,IAAI,CAAC,SAAS,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC;QAChC,OAAO,IAAI,CAAC;IACd,CAAC;IAED,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAoB,CAAC;QAElE,2BAA2B;QAC3B,IAAI,CAAC,MAAM,CAAC,OAAO,IAAI,CAAC,MAAM,CAAC,KAAK,IAAI,CAAC,MAAM,CAAC,QAAQ,EAAE,CAAC;YACzD,OAAO,IAAI,CAAC;QACd,CAAC;QAED,OAAO,MAAM,CAAC;IAChB,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,CAAC;IACd,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Parsed GitHub URL components
|
|
3
|
+
*/
|
|
4
|
+
export interface GitHubUrlInfo {
|
|
5
|
+
owner: string;
|
|
6
|
+
repo: string;
|
|
7
|
+
ref: string;
|
|
8
|
+
path: string;
|
|
9
|
+
useSsh: boolean;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Parse a GitHub folder URL into components
|
|
13
|
+
*
|
|
14
|
+
* Supports formats:
|
|
15
|
+
* - https://github.com/owner/repo/tree/main/path/to/folder
|
|
16
|
+
* - https://github.com/owner/repo/tree/v1.0.0/path/to/folder
|
|
17
|
+
* - github:owner/repo/path/to/folder (defaults to main branch)
|
|
18
|
+
* - github:owner/repo/path/to/folder@v1.0.0
|
|
19
|
+
* - git@github.com:owner/repo/path/to/folder (SSH)
|
|
20
|
+
* - git@github.com:owner/repo/path/to/folder@v1.0.0 (SSH with ref)
|
|
21
|
+
*
|
|
22
|
+
* @param url - GitHub URL to parse
|
|
23
|
+
* @returns Parsed URL components or null if not a valid GitHub URL
|
|
24
|
+
*/
|
|
25
|
+
export declare function parseGitHubUrl(url: string): GitHubUrlInfo | null;
|
|
26
|
+
/**
|
|
27
|
+
* Check if a string is a GitHub URL
|
|
28
|
+
*/
|
|
29
|
+
export declare function isGitHubUrl(url: string): boolean;
|
|
30
|
+
/**
|
|
31
|
+
* Fetch contents of a GitHub folder recursively
|
|
32
|
+
*
|
|
33
|
+
* Uses git sparse-checkout for SSH URLs (or when API fails),
|
|
34
|
+
* otherwise uses GitHub Contents API for HTTPS.
|
|
35
|
+
*
|
|
36
|
+
* @param info - Parsed GitHub URL info
|
|
37
|
+
* @param targetDir - Directory to write files to
|
|
38
|
+
* @param onProgress - Optional progress callback
|
|
39
|
+
*/
|
|
40
|
+
export declare function fetchGitHubFolder(info: GitHubUrlInfo, targetDir: string, onProgress?: (message: string) => void): Promise<void>;
|
|
41
|
+
//# sourceMappingURL=github.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"github.d.ts","sourceRoot":"","sources":["../../src/pack-installer/github.ts"],"names":[],"mappings":"AAIA;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,OAAO,CAAC;CACjB;AAaD;;;;;;;;;;;;;GAaG;AACH,wBAAgB,cAAc,CAAC,GAAG,EAAE,MAAM,GAAG,aAAa,GAAG,IAAI,CA+GhE;AAED;;GAEG;AACH,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAOhD;AA+FD;;;;;;;;;GASG;AACH,wBAAsB,iBAAiB,CACrC,IAAI,EAAE,aAAa,EACnB,SAAS,EAAE,MAAM,EACjB,UAAU,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,GACrC,OAAO,CAAC,IAAI,CAAC,CAiBf"}
|