anymous 1.0.4 → 1.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.
- package/LICENSE +21 -0
- package/bin/anymous.cjs +45 -45
- package/package.json +1 -1
- package/{script/postinstall.mjs → postinstall.mjs} +5 -5
- package/src/account/account.ts +5 -5
- package/src/account/repo.ts +5 -5
- package/src/acp/agent.ts +2 -2
- package/src/acp/content.ts +1 -1
- package/src/acp/directory.ts +5 -5
- package/src/acp/event.ts +4 -4
- package/src/acp/permission.ts +2 -2
- package/src/acp/profile.ts +1 -1
- package/src/acp/service.ts +24 -24
- package/src/acp/session.ts +5 -5
- package/src/acp/usage.ts +11 -11
- package/src/agent/agent.ts +13 -13
- package/src/agent/prompt/debug-tools.txt +40 -40
- package/src/agent/prompt/exe-extractor.txt +39 -39
- package/src/agent/prompt/memory-dump.txt +37 -37
- package/src/agent/prompt/reverser-automator.txt +38 -38
- package/src/agent/prompt/reverser-binary.txt +39 -39
- package/src/agent/prompt/reverser-dynamic.txt +36 -36
- package/src/agent/prompt/reverser-source.txt +38 -38
- package/src/agent/prompt/reverser-static.txt +35 -35
- package/src/agent/subagent-permissions.ts +1 -1
- package/src/auth/index.ts +8 -8
- package/src/background/job.ts +3 -3
- package/src/cli/cmd/account.ts +1 -1
- package/src/cli/cmd/acp.ts +3 -3
- package/src/cli/cmd/agent.ts +2 -2
- package/src/cli/cmd/attach.ts +3 -3
- package/src/cli/cmd/db.ts +1 -1
- package/src/cli/cmd/debug/agent.handler.ts +2 -2
- package/src/cli/cmd/debug/file.ts +4 -4
- package/src/cli/cmd/debug/index.ts +5 -5
- package/src/cli/cmd/debug/ripgrep.ts +1 -1
- package/src/cli/cmd/debug/scrap.ts +2 -2
- package/src/cli/cmd/debug/v2.ts +4 -4
- package/src/cli/cmd/export.ts +1 -1
- package/src/cli/cmd/generate.ts +2 -2
- package/src/cli/cmd/github.handler.ts +27 -27
- package/src/cli/cmd/github.shared.ts +1 -1
- package/src/cli/cmd/import.ts +5 -5
- package/src/cli/cmd/mcp.ts +13 -13
- package/src/cli/cmd/models.ts +6 -6
- package/src/cli/cmd/plug.ts +2 -2
- package/src/cli/cmd/pr.ts +6 -6
- package/src/cli/cmd/prompt-display.ts +1 -1
- package/src/cli/cmd/providers.ts +12 -12
- package/src/cli/cmd/run/demo.ts +3 -3
- package/src/cli/cmd/run/footer.command.tsx +2 -2
- package/src/cli/cmd/run/footer.permission.tsx +3 -3
- package/src/cli/cmd/run/footer.prompt.tsx +9 -9
- package/src/cli/cmd/run/footer.question.tsx +1 -1
- package/src/cli/cmd/run/footer.subagent.tsx +3 -3
- package/src/cli/cmd/run/footer.ts +2 -2
- package/src/cli/cmd/run/footer.view.tsx +9 -9
- package/src/cli/cmd/run/permission.shared.ts +3 -3
- package/src/cli/cmd/run/question.shared.ts +1 -1
- package/src/cli/cmd/run/runtime.boot.ts +2 -2
- package/src/cli/cmd/run/runtime.lifecycle.ts +4 -4
- package/src/cli/cmd/run/runtime.ts +6 -6
- package/src/cli/cmd/run/session-data.ts +1 -1
- package/src/cli/cmd/run/session-replay.ts +1 -1
- package/src/cli/cmd/run/splash.ts +13 -5
- package/src/cli/cmd/run/stream.transport.ts +3 -3
- package/src/cli/cmd/run/subagent-data.ts +1 -1
- package/src/cli/cmd/run/theme.ts +2 -2
- package/src/cli/cmd/run/tool.ts +2 -2
- package/src/cli/cmd/run/trace.ts +4 -4
- package/src/cli/cmd/run/types.ts +13 -13
- package/src/cli/cmd/run/variant.shared.ts +5 -5
- package/src/cli/cmd/run.ts +22 -22
- package/src/cli/cmd/serve.ts +4 -4
- package/src/cli/cmd/session.ts +4 -4
- package/src/cli/cmd/stats.ts +2 -2
- package/src/cli/cmd/tui.ts +7 -7
- package/src/cli/cmd/uninstall.ts +21 -21
- package/src/cli/cmd/upgrade.ts +14 -14
- package/src/cli/cmd/web.ts +4 -4
- package/src/cli/error.ts +1 -1
- package/src/cli/heap.ts +3 -3
- package/src/cli/logo.ts +1 -1
- package/src/cli/network.ts +1 -1
- package/src/cli/tui/layer.ts +3 -3
- package/src/cli/tui/validate-session.ts +2 -2
- package/src/cli/ui.ts +12 -9
- package/src/cli/upgrade.ts +11 -11
- package/src/command/index.ts +3 -3
- package/src/command/template/initialize.txt +3 -3
- package/src/config/agent.ts +2 -2
- package/src/config/command.ts +3 -3
- package/src/config/config.ts +49 -49
- package/src/config/managed.ts +6 -6
- package/src/config/markdown.ts +2 -2
- package/src/config/parse.ts +2 -2
- package/src/config/paths.ts +7 -7
- package/src/config/plugin.ts +2 -2
- package/src/config/tui-host-attention.ts +2 -2
- package/src/config/tui-migrate.ts +12 -12
- package/src/config/tui.ts +23 -23
- package/src/config/variable.ts +1 -1
- package/src/control-plane/adapters/index.ts +1 -1
- package/src/control-plane/dev/README.md +5 -5
- package/src/control-plane/dev/debug-workspace-plugin.ts +2 -2
- package/src/control-plane/types.ts +3 -3
- package/src/control-plane/workspace-context.ts +1 -1
- package/src/control-plane/workspace.ts +17 -17
- package/src/effect/app-node-builder-v1.ts +2 -2
- package/src/effect/app-runtime.ts +9 -9
- package/src/effect/bootstrap-runtime.ts +4 -4
- package/src/effect/bridge.ts +1 -1
- package/src/effect/config-service.ts +3 -3
- package/src/effect/instance-ref.ts +3 -3
- package/src/effect/instance-state.ts +1 -1
- package/src/effect/run-service.ts +2 -2
- package/src/effect/runtime-flags.ts +34 -34
- package/src/env/index.ts +3 -3
- package/src/event-manifest.ts +1 -1
- package/src/event-v2-bridge.ts +7 -7
- package/src/format/formatter.ts +2 -2
- package/src/format/index.ts +4 -4
- package/src/git/index.ts +3 -3
- package/src/ide/index.ts +4 -4
- package/src/image/image.ts +4 -4
- package/src/index.ts +1 -1
- package/src/installation/index.ts +32 -32
- package/src/lsp/lsp.ts +5 -5
- package/src/lsp/server.ts +5 -5
- package/src/mcp/auth.ts +6 -6
- package/src/mcp/browser.ts +2 -2
- package/src/mcp/index.ts +17 -17
- package/src/mcp/oauth-callback.ts +1 -1
- package/src/mcp/oauth-provider.ts +2 -2
- package/src/node.ts +1 -1
- package/src/patch/index.ts +1 -1
- package/src/permission/index.ts +5 -5
- package/src/plugin/azure.ts +1 -1
- package/src/plugin/cloudflare.ts +1 -1
- package/src/plugin/digitalocean.ts +6 -6
- package/src/plugin/github-copilot/copilot.ts +7 -7
- package/src/plugin/github-copilot/models.ts +2 -2
- package/src/plugin/index.ts +7 -7
- package/src/plugin/install.ts +6 -6
- package/src/plugin/loader.ts +3 -3
- package/src/plugin/meta.ts +4 -4
- package/src/plugin/openai/README.md +1 -1
- package/src/plugin/openai/codex.ts +8 -8
- package/src/plugin/openai/ws-pool.ts +1 -1
- package/src/plugin/pty-environment.ts +1 -1
- package/src/plugin/shared.ts +7 -7
- package/src/plugin/snowflake-cortex.ts +6 -6
- package/src/plugin/tui/internal.ts +1 -1
- package/src/plugin/tui/runtime.ts +17 -17
- package/src/plugin/xai.ts +8 -8
- package/src/project/bootstrap-service.ts +1 -1
- package/src/project/bootstrap.ts +1 -1
- package/src/project/instance-context.ts +1 -1
- package/src/project/instance-store.ts +5 -5
- package/src/project/project.ts +18 -18
- package/src/project/vcs.ts +5 -5
- package/src/provider/auth.ts +6 -6
- package/src/provider/error.ts +3 -3
- package/src/provider/model-status.ts +1 -1
- package/src/provider/provider.ts +38 -38
- package/src/provider/transform.ts +4 -4
- package/src/question/index.ts +3 -3
- package/src/question/schema.ts +1 -1
- package/src/server/auth.ts +6 -6
- package/src/server/event.ts +1 -1
- package/src/server/mdns.ts +2 -2
- package/src/server/proxy-util.ts +2 -2
- package/src/server/routes/instance/httpapi/api.ts +10 -10
- package/src/server/routes/instance/httpapi/groups/config.ts +4 -4
- package/src/server/routes/instance/httpapi/groups/control-plane.ts +1 -1
- package/src/server/routes/instance/httpapi/groups/control.ts +1 -1
- package/src/server/routes/instance/httpapi/groups/experimental.ts +7 -7
- package/src/server/routes/instance/httpapi/groups/file.ts +3 -3
- package/src/server/routes/instance/httpapi/groups/global.ts +10 -10
- package/src/server/routes/instance/httpapi/groups/instance.ts +6 -6
- package/src/server/routes/instance/httpapi/groups/mcp.ts +2 -2
- package/src/server/routes/instance/httpapi/groups/permission.ts +2 -2
- package/src/server/routes/instance/httpapi/groups/project-copy.ts +1 -1
- package/src/server/routes/instance/httpapi/groups/project.ts +4 -4
- package/src/server/routes/instance/httpapi/groups/provider.ts +2 -2
- package/src/server/routes/instance/httpapi/groups/pty.ts +5 -5
- package/src/server/routes/instance/httpapi/groups/question.ts +1 -1
- package/src/server/routes/instance/httpapi/groups/session.ts +8 -8
- package/src/server/routes/instance/httpapi/groups/sync.ts +3 -3
- package/src/server/routes/instance/httpapi/groups/tui.ts +1 -1
- package/src/server/routes/instance/httpapi/groups/workspace.ts +1 -1
- package/src/server/routes/instance/httpapi/handlers/control-plane.ts +2 -2
- package/src/server/routes/instance/httpapi/handlers/control.ts +1 -1
- package/src/server/routes/instance/httpapi/handlers/event.ts +1 -1
- package/src/server/routes/instance/httpapi/handlers/file.ts +6 -6
- package/src/server/routes/instance/httpapi/handlers/global.ts +2 -2
- package/src/server/routes/instance/httpapi/handlers/instance.ts +1 -1
- package/src/server/routes/instance/httpapi/handlers/permission.ts +1 -1
- package/src/server/routes/instance/httpapi/handlers/project-copy.ts +2 -2
- package/src/server/routes/instance/httpapi/handlers/project.ts +1 -1
- package/src/server/routes/instance/httpapi/handlers/provider.ts +2 -2
- package/src/server/routes/instance/httpapi/handlers/pty.ts +9 -9
- package/src/server/routes/instance/httpapi/handlers/session.ts +3 -3
- package/src/server/routes/instance/httpapi/handlers/sync.ts +3 -3
- package/src/server/routes/instance/httpapi/middleware/authorization.ts +3 -3
- package/src/server/routes/instance/httpapi/middleware/error.ts +2 -2
- package/src/server/routes/instance/httpapi/middleware/fence.ts +3 -3
- package/src/server/routes/instance/httpapi/middleware/instance-context.ts +1 -1
- package/src/server/routes/instance/httpapi/middleware/schema-error.ts +1 -1
- package/src/server/routes/instance/httpapi/middleware/workspace-routing.ts +6 -6
- package/src/server/routes/instance/httpapi/public.ts +6 -6
- package/src/server/routes/instance/httpapi/server.ts +27 -27
- package/src/server/routes/instance/httpapi/websocket-tracker.ts +2 -2
- package/src/server/server.ts +3 -3
- package/src/server/shared/fence.ts +4 -4
- package/src/server/shared/pty-ticket.ts +1 -1
- package/src/server/shared/ui.ts +3 -3
- package/src/server/tui-event.ts +1 -1
- package/src/session/compaction.ts +9 -9
- package/src/session/instruction.ts +9 -9
- package/src/session/llm/AGENTS.md +12 -12
- package/src/session/llm/ai-sdk.ts +2 -2
- package/src/session/llm/native-request.ts +4 -4
- package/src/session/llm/native-runtime.ts +7 -7
- package/src/session/llm/request.ts +10 -10
- package/src/session/llm.ts +12 -12
- package/src/session/message-error.ts +1 -1
- package/src/session/message-v2.ts +7 -7
- package/src/session/message.ts +3 -3
- package/src/session/overflow.ts +2 -2
- package/src/session/processor.ts +6 -6
- package/src/session/prompt/anthropic.txt +2 -11
- package/src/session/prompt/beast.txt +147 -147
- package/src/session/prompt/codex.txt +1 -1
- package/src/session/prompt/copilot-gpt-5.txt +1 -1
- package/src/session/prompt/default.txt +1 -7
- package/src/session/prompt/gemini.txt +1 -1
- package/src/session/prompt/gpt.txt +1 -1
- package/src/session/prompt/kimi.txt +1 -1
- package/src/session/prompt/meta.txt +3 -4
- package/src/session/prompt/trinity.txt +1 -1
- package/src/session/prompt.ts +14 -14
- package/src/session/reminders.ts +2 -2
- package/src/session/retry.ts +5 -5
- package/src/session/revert.ts +3 -3
- package/src/session/run-state.ts +3 -3
- package/src/session/schema.ts +2 -2
- package/src/session/session.ts +22 -22
- package/src/session/status.ts +3 -3
- package/src/session/summary.ts +3 -3
- package/src/session/system.ts +7 -7
- package/src/session/todo.ts +5 -5
- package/src/session/tools.ts +3 -3
- package/src/share/session.ts +2 -2
- package/src/share/share-next.ts +11 -11
- package/src/skill/discovery.ts +7 -7
- package/src/skill/index.ts +21 -21
- package/src/snapshot/index.ts +7 -7
- package/src/storage/schema.ts +5 -5
- package/src/storage/storage.ts +5 -5
- package/src/sync/schema.ts +1 -1
- package/src/temporary.ts +4 -4
- package/src/tool/apply_patch.ts +3 -3
- package/src/tool/code-mode.ts +1 -1
- package/src/tool/edit.ts +3 -3
- package/src/tool/external-directory.ts +1 -1
- package/src/tool/glob.ts +2 -2
- package/src/tool/grep.ts +2 -2
- package/src/tool/lsp.ts +1 -1
- package/src/tool/lsp.txt +1 -1
- package/src/tool/plan.ts +1 -1
- package/src/tool/read.ts +2 -2
- package/src/tool/registry.ts +13 -13
- package/src/tool/schema.ts +1 -1
- package/src/tool/shell/id.ts +1 -1
- package/src/tool/shell/prompt.ts +2 -2
- package/src/tool/shell.ts +2 -2
- package/src/tool/skill.ts +1 -1
- package/src/tool/task.ts +3 -3
- package/src/tool/tool.ts +2 -2
- package/src/tool/truncate.ts +4 -4
- package/src/tool/truncation-dir.ts +1 -1
- package/src/tool/webfetch.ts +1 -1
- package/src/tool/websearch.ts +4 -4
- package/src/tool/write.ts +3 -3
- package/src/util/bom.ts +1 -1
- package/src/util/error.ts +1 -1
- package/src/util/filesystem.ts +2 -2
- package/src/util/locale.ts +2 -2
- package/src/util/process.ts +1 -1
- package/src/util/record.ts +1 -1
- package/src/util/repository.ts +2 -2
- package/src/util/token.ts +1 -1
- package/src/worktree/index.ts +12 -12
package/src/cli/ui.ts
CHANGED
|
@@ -3,10 +3,11 @@ import { Schema } from "effect"
|
|
|
3
3
|
import { logo as glyphs } from "./logo"
|
|
4
4
|
|
|
5
5
|
const wordmark = [
|
|
6
|
-
`
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
6
|
+
` █████ ███ ██ ███ ██ ██████ ██████ █████ ██████ `,
|
|
7
|
+
`██ ██ ████ ██ ████ ██ ██ ██ ██ ██ ██ ██ ██ `,
|
|
8
|
+
`███████ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ █████ ███████ `,
|
|
9
|
+
`██ ██ ██ ████ ██ ████ ██ ██ ██ ██ ██ ██ ██ `,
|
|
10
|
+
`██ ██ ██ ███ ██ ███ ██████ ██████ ██ ██ ██████ `,
|
|
10
11
|
]
|
|
11
12
|
|
|
12
13
|
export class CancelledError extends Schema.TaggedErrorClass<CancelledError>()("UICancelledError", {}) {}
|
|
@@ -53,19 +54,19 @@ export function logo(pad?: string) {
|
|
|
53
54
|
result.push(row)
|
|
54
55
|
result.push(EOL)
|
|
55
56
|
}
|
|
56
|
-
result.push("AI-Powered Reverse Engineering Platform")
|
|
57
|
+
result.push("AI-Powered Reverse Engineering & Pentest Platform v1.0.5")
|
|
57
58
|
return result.join("")
|
|
58
59
|
}
|
|
59
60
|
|
|
60
61
|
const result: string[] = []
|
|
61
62
|
const reset = "\x1b[0m"
|
|
62
63
|
const left = {
|
|
63
|
-
fg: "\x1b[
|
|
64
|
-
shadow: "\x1b[38;5;
|
|
64
|
+
fg: "\x1b[38;5;117m",
|
|
65
|
+
shadow: "\x1b[38;5;24m",
|
|
65
66
|
bg: "\x1b[48;5;235m",
|
|
66
67
|
}
|
|
67
68
|
const right = {
|
|
68
|
-
fg:
|
|
69
|
+
fg: "\x1b[38;5;195m",
|
|
69
70
|
shadow: "\x1b[38;5;238m",
|
|
70
71
|
bg: "\x1b[48;5;238m",
|
|
71
72
|
}
|
|
@@ -101,7 +102,9 @@ export function logo(pad?: string) {
|
|
|
101
102
|
result.push(draw(other, right.fg, right.shadow, right.bg))
|
|
102
103
|
result.push(EOL)
|
|
103
104
|
})
|
|
104
|
-
result.push(Style.TEXT_NORMAL, "
|
|
105
|
+
result.push(Style.TEXT_NORMAL, "─".repeat(45), EOL)
|
|
106
|
+
result.push(Style.TEXT_INFO, "▸", Style.TEXT_NORMAL, " AI-Powered Reverse Engineering & Pentest Platform ", Style.TEXT_DIM, "v1.0.5", EOL)
|
|
107
|
+
result.push(Style.TEXT_NORMAL, "─".repeat(45))
|
|
105
108
|
return result.join("").trimEnd()
|
|
106
109
|
}
|
|
107
110
|
|
package/src/cli/upgrade.ts
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { Config } from "@/config/config"
|
|
2
2
|
import { AppRuntime } from "@/effect/app-runtime"
|
|
3
|
-
import { Flag } from "@
|
|
3
|
+
import { Flag } from "@anymous-ai/core/flag/flag"
|
|
4
4
|
import { Installation } from "@/installation"
|
|
5
|
-
import { InstallationVersion } from "@
|
|
5
|
+
import { InstallationVersion } from "@anymous-ai/core/installation/version"
|
|
6
6
|
import { GlobalBus } from "@/bus/global"
|
|
7
7
|
|
|
8
|
-
const
|
|
8
|
+
const ANYMOUS_RELEASES = "https://api.github.com/repos/anymousdark/anymous/releases/latest"
|
|
9
9
|
|
|
10
|
-
async function
|
|
10
|
+
async function checkanymousUpdate(): Promise<string | null> {
|
|
11
11
|
try {
|
|
12
|
-
const resp = await fetch(
|
|
12
|
+
const resp = await fetch(ANYMOUS_RELEASES, { headers: { "User-Agent": "anymous" } })
|
|
13
13
|
if (!resp.ok) return null
|
|
14
14
|
const data: any = await resp.json()
|
|
15
15
|
return (data.tag_name as string).replace(/^v/, "")
|
|
@@ -20,16 +20,16 @@ async function checkOpenCodeUpdate(): Promise<string | null> {
|
|
|
20
20
|
|
|
21
21
|
export async function upgrade() {
|
|
22
22
|
const config = await AppRuntime.runPromise(Config.Service.use((cfg) => cfg.getGlobal()))
|
|
23
|
-
if (config.autoupdate === false || Flag.
|
|
23
|
+
if (config.autoupdate === false || Flag.ANYMOUS_DISABLE_AUTOUPDATE) return
|
|
24
24
|
|
|
25
|
-
// Check if
|
|
26
|
-
const
|
|
27
|
-
if (
|
|
25
|
+
// Check if anymous has a newer release (sync needed)
|
|
26
|
+
const anymousLatest = await checkanymousUpdate()
|
|
27
|
+
if (anymousLatest && anymousLatest !== InstallationVersion) {
|
|
28
28
|
GlobalBus.emit("event", {
|
|
29
29
|
directory: "global",
|
|
30
30
|
payload: {
|
|
31
31
|
type: Installation.Event.UpdateAvailable.type,
|
|
32
|
-
properties: { version: `
|
|
32
|
+
properties: { version: `anymous v${anymousLatest} — run 'bun run script/sync-anymous.ts' to sync` },
|
|
33
33
|
},
|
|
34
34
|
})
|
|
35
35
|
}
|
|
@@ -38,7 +38,7 @@ export async function upgrade() {
|
|
|
38
38
|
const latest = await Installation.latest(method).catch(() => {})
|
|
39
39
|
if (!latest) return
|
|
40
40
|
|
|
41
|
-
if (Flag.
|
|
41
|
+
if (Flag.ANYMOUS_ALWAYS_NOTIFY_UPDATE) {
|
|
42
42
|
GlobalBus.emit("event", {
|
|
43
43
|
directory: "global",
|
|
44
44
|
payload: {
|
package/src/command/index.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { LayerNode } from "@
|
|
1
|
+
import { LayerNode } from "@anymous-ai/core/effect/layer-node"
|
|
2
2
|
import path from "path"
|
|
3
3
|
import { InstanceState } from "@/effect/instance-state"
|
|
4
4
|
import { EffectBridge } from "@/effect/bridge"
|
|
@@ -9,7 +9,7 @@ import { MCP } from "../mcp"
|
|
|
9
9
|
import { Skill } from "../skill"
|
|
10
10
|
import PROMPT_INITIALIZE from "./template/initialize.txt"
|
|
11
11
|
import PROMPT_REVIEW from "./template/review.txt"
|
|
12
|
-
import { LegacyEvent } from "@
|
|
12
|
+
import { LegacyEvent } from "@anymous-ai/schema/legacy-event"
|
|
13
13
|
|
|
14
14
|
type State = {
|
|
15
15
|
commands: Record<string, Info>
|
|
@@ -53,7 +53,7 @@ export interface Interface {
|
|
|
53
53
|
readonly list: () => Effect.Effect<Info[]>
|
|
54
54
|
}
|
|
55
55
|
|
|
56
|
-
export class Service extends Context.Service<Service, Interface>()("@
|
|
56
|
+
export class Service extends Context.Service<Service, Interface>()("@anymous/Command") {}
|
|
57
57
|
|
|
58
58
|
const layer = Layer.effect(
|
|
59
59
|
Service,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Create or update `AGENTS.md` for this repository.
|
|
2
2
|
|
|
3
|
-
The goal is a compact instruction file that helps future
|
|
3
|
+
The goal is a compact instruction file that helps future anymous sessions avoid mistakes and ramp up quickly. Every line should answer: "Would an agent likely miss this without help?" If not, leave it out.
|
|
4
4
|
|
|
5
5
|
User-provided focus or constraints (honor these):
|
|
6
6
|
$ARGUMENTS
|
|
@@ -12,7 +12,7 @@ Read the highest-value sources first:
|
|
|
12
12
|
- build, test, lint, formatter, typecheck, and codegen config
|
|
13
13
|
- CI workflows and pre-commit / task runner config
|
|
14
14
|
- existing instruction files (`AGENTS.md`, `CLAUDE.md`, `.cursor/rules/`, `.cursorrules`, `.github/copilot-instructions.md`)
|
|
15
|
-
- repo-local
|
|
15
|
+
- repo-local anymous config such as `anymous.json`
|
|
16
16
|
|
|
17
17
|
If architecture is still unclear after reading config and docs, inspect a small number of representative code files to find the real entrypoints, package boundaries, and execution flow. Prefer reading the files that explain how the system is wired together over random leaf files.
|
|
18
18
|
|
|
@@ -57,7 +57,7 @@ Exclude:
|
|
|
57
57
|
- long tutorials or exhaustive file trees
|
|
58
58
|
- obvious language conventions
|
|
59
59
|
- speculative claims or anything you could not verify
|
|
60
|
-
- content better stored in another file referenced via `
|
|
60
|
+
- content better stored in another file referenced via `anymous.json` `instructions`
|
|
61
61
|
|
|
62
62
|
When in doubt, omit.
|
|
63
63
|
|
package/src/config/agent.ts
CHANGED
|
@@ -2,8 +2,8 @@ export * as ConfigAgent from "./agent"
|
|
|
2
2
|
|
|
3
3
|
import path from "path"
|
|
4
4
|
import { Exit, Schema } from "effect"
|
|
5
|
-
import { Glob } from "@
|
|
6
|
-
import { ConfigAgentV1 } from "@
|
|
5
|
+
import { Glob } from "@anymous-ai/core/util/glob"
|
|
6
|
+
import { ConfigAgentV1 } from "@anymous-ai/core/v1/config/agent"
|
|
7
7
|
import { configEntryNameFromPath } from "./entry-name"
|
|
8
8
|
import * as ConfigMarkdown from "./markdown"
|
|
9
9
|
import { ConfigParse } from "./parse"
|
package/src/config/command.ts
CHANGED
|
@@ -2,10 +2,10 @@ export * as ConfigCommand from "./command"
|
|
|
2
2
|
|
|
3
3
|
import path from "path"
|
|
4
4
|
import { Cause, Exit, Schema } from "effect"
|
|
5
|
-
import { Glob } from "@
|
|
6
|
-
import { ConfigCommandV1 } from "@
|
|
5
|
+
import { Glob } from "@anymous-ai/core/util/glob"
|
|
6
|
+
import { ConfigCommandV1 } from "@anymous-ai/core/v1/config/command"
|
|
7
7
|
import { configEntryNameFromPath } from "./entry-name"
|
|
8
|
-
import { InvalidError } from "@
|
|
8
|
+
import { InvalidError } from "@anymous-ai/core/v1/config/error"
|
|
9
9
|
import * as ConfigMarkdown from "./markdown"
|
|
10
10
|
|
|
11
11
|
const decodeInfo = Schema.decodeUnknownExit(ConfigCommandV1.Info)
|
package/src/config/config.ts
CHANGED
|
@@ -1,31 +1,31 @@
|
|
|
1
|
-
import { LayerNode } from "@
|
|
2
|
-
import { httpClient } from "@
|
|
3
|
-
import { serviceUse } from "@
|
|
1
|
+
import { LayerNode } from "@anymous-ai/core/effect/layer-node"
|
|
2
|
+
import { httpClient } from "@anymous-ai/core/effect/app-node-platform"
|
|
3
|
+
import { serviceUse } from "@anymous-ai/core/effect/service-use"
|
|
4
4
|
import path from "path"
|
|
5
5
|
import { pathToFileURL } from "url"
|
|
6
6
|
import os from "os"
|
|
7
7
|
import { mergeDeep } from "remeda"
|
|
8
|
-
import { Global } from "@
|
|
8
|
+
import { Global } from "@anymous-ai/core/global"
|
|
9
9
|
import fsNode from "fs/promises"
|
|
10
|
-
import { Flag } from "@
|
|
10
|
+
import { Flag } from "@anymous-ai/core/flag/flag"
|
|
11
11
|
import { Auth } from "../auth"
|
|
12
12
|
import { Env } from "../env"
|
|
13
13
|
import { applyEdits, modify } from "jsonc-parser"
|
|
14
|
-
import { InstallationLocal, InstallationVersion } from "@
|
|
14
|
+
import { InstallationLocal, InstallationVersion } from "@anymous-ai/core/installation/version"
|
|
15
15
|
import { existsSync } from "fs"
|
|
16
16
|
import { Account } from "@/account/account"
|
|
17
17
|
import { isRecord } from "@/util/record"
|
|
18
|
-
import type { ConsoleState } from "@
|
|
19
|
-
import { FSUtil } from "@
|
|
18
|
+
import type { ConsoleState } from "@anymous-ai/core/v1/config/console-state"
|
|
19
|
+
import { FSUtil } from "@anymous-ai/core/fs-util"
|
|
20
20
|
import { InstanceState } from "@/effect/instance-state"
|
|
21
21
|
import { Context, Duration, Effect, Exit, Fiber, Layer, Option, Schema } from "effect"
|
|
22
22
|
import { FetchHttpClient, HttpClient, HttpClientRequest } from "effect/unstable/http"
|
|
23
|
-
import { EffectFlock } from "@
|
|
23
|
+
import { EffectFlock } from "@anymous-ai/core/util/effect-flock"
|
|
24
24
|
import { containsPath, type InstanceContext } from "../project/instance-context"
|
|
25
|
-
import { ConfigV1 } from "@
|
|
26
|
-
import { RemoteAuthError } from "@
|
|
27
|
-
import { ConfigPermissionV1 } from "@
|
|
28
|
-
import { ConfigPluginV1 } from "@
|
|
25
|
+
import { ConfigV1 } from "@anymous-ai/core/v1/config/config"
|
|
26
|
+
import { RemoteAuthError } from "@anymous-ai/core/v1/config/error"
|
|
27
|
+
import { ConfigPermissionV1 } from "@anymous-ai/core/v1/config/permission"
|
|
28
|
+
import { ConfigPluginV1 } from "@anymous-ai/core/v1/config/plugin"
|
|
29
29
|
import { ConfigAgent } from "./agent"
|
|
30
30
|
import { ConfigCommand } from "./command"
|
|
31
31
|
import { ConfigManaged } from "./managed"
|
|
@@ -33,7 +33,7 @@ import { ConfigParse } from "./parse"
|
|
|
33
33
|
import { ConfigPaths } from "./paths"
|
|
34
34
|
import { ConfigPlugin } from "./plugin"
|
|
35
35
|
import { ConfigVariable } from "./variable"
|
|
36
|
-
import { Npm } from "@
|
|
36
|
+
import { Npm } from "@anymous-ai/core/npm"
|
|
37
37
|
import { withTransientReadRetry } from "@/util/effect-http-client"
|
|
38
38
|
|
|
39
39
|
// Custom merge function that concatenates array fields instead of replacing them
|
|
@@ -132,12 +132,12 @@ export interface Interface {
|
|
|
132
132
|
readonly waitForDependencies: () => Effect.Effect<void>
|
|
133
133
|
}
|
|
134
134
|
|
|
135
|
-
export class Service extends Context.Service<Service, Interface>()("@
|
|
135
|
+
export class Service extends Context.Service<Service, Interface>()("@anymous/Config") {}
|
|
136
136
|
|
|
137
137
|
export const use = serviceUse(Service)
|
|
138
138
|
|
|
139
139
|
function globalConfigFile() {
|
|
140
|
-
const candidates = ["
|
|
140
|
+
const candidates = ["anymous.jsonc", "anymous.json", "config.json"].map((file) =>
|
|
141
141
|
path.join(Global.Path.config, file),
|
|
142
142
|
)
|
|
143
143
|
for (const file of candidates) {
|
|
@@ -229,8 +229,8 @@ const layer = Layer.effect(
|
|
|
229
229
|
|
|
230
230
|
yield* Effect.promise(() => resolveLoadedPlugins(data, options.path))
|
|
231
231
|
if (!data.$schema) {
|
|
232
|
-
data.$schema = "https://
|
|
233
|
-
const updated = text.replace(/^\s*\{/, '{\n "$schema": "https://
|
|
232
|
+
data.$schema = "https://anymous-cli.vercel.app/config.json"
|
|
233
|
+
const updated = text.replace(/^\s*\{/, '{\n "$schema": "https://anymous-cli.vercel.app/config.json",')
|
|
234
234
|
yield* fs.writeFileString(options.path, updated).pipe(Effect.catch(() => Effect.void))
|
|
235
235
|
}
|
|
236
236
|
return data
|
|
@@ -247,17 +247,17 @@ const layer = Layer.effect(
|
|
|
247
247
|
let result: Info = {}
|
|
248
248
|
// Seed the default global config with the schema for editor completion, but avoid writing when the user
|
|
249
249
|
// explicitly routes config through env-provided paths or content.
|
|
250
|
-
if (!Flag.
|
|
250
|
+
if (!Flag.ANYMOUS_CONFIG && !Flag.ANYMOUS_CONFIG_DIR && !Flag.ANYMOUS_CONFIG_CONTENT) {
|
|
251
251
|
const file = globalConfigFile()
|
|
252
252
|
if (!existsSync(file)) {
|
|
253
253
|
yield* fs
|
|
254
|
-
.writeWithDirs(file, JSON.stringify({ $schema: "https://
|
|
254
|
+
.writeWithDirs(file, JSON.stringify({ $schema: "https://anymous-cli.vercel.app/config.json" }, null, 2))
|
|
255
255
|
.pipe(Effect.catch(() => Effect.void))
|
|
256
256
|
}
|
|
257
257
|
}
|
|
258
258
|
result = mergeConfig(result, yield* loadFile(path.join(Global.Path.config, "config.json"), env))
|
|
259
|
-
result = mergeConfig(result, yield* loadFile(path.join(Global.Path.config, "
|
|
260
|
-
result = mergeConfig(result, yield* loadFile(path.join(Global.Path.config, "
|
|
259
|
+
result = mergeConfig(result, yield* loadFile(path.join(Global.Path.config, "anymous.json"), env))
|
|
260
|
+
result = mergeConfig(result, yield* loadFile(path.join(Global.Path.config, "anymous.jsonc"), env))
|
|
261
261
|
|
|
262
262
|
const legacy = path.join(Global.Path.config, "config")
|
|
263
263
|
if (existsSync(legacy)) {
|
|
@@ -266,7 +266,7 @@ const layer = Layer.effect(
|
|
|
266
266
|
.then(async (mod) => {
|
|
267
267
|
const { provider, model, ...rest } = mod.default
|
|
268
268
|
if (provider && model) result.model = `${provider}/${model}`
|
|
269
|
-
result["$schema"] = "https://
|
|
269
|
+
result["$schema"] = "https://anymous-cli.vercel.app/config.json"
|
|
270
270
|
result = mergeConfig(result, rest)
|
|
271
271
|
await fsNode.writeFile(path.join(Global.Path.config, "config.json"), JSON.stringify(result, null, 2))
|
|
272
272
|
await fsNode.unlink(legacy)
|
|
@@ -322,7 +322,7 @@ const layer = Layer.effect(
|
|
|
322
322
|
|
|
323
323
|
const pluginScopeForSource = Effect.fnUntraced(function* (source: string) {
|
|
324
324
|
if (source.startsWith("http://") || source.startsWith("https://")) return "global"
|
|
325
|
-
if (source === "
|
|
325
|
+
if (source === "ANYMOUS_CONFIG_CONTENT") return "local"
|
|
326
326
|
if (containsPath(source, ctx)) return "local"
|
|
327
327
|
return "global"
|
|
328
328
|
})
|
|
@@ -357,7 +357,7 @@ const layer = Layer.effect(
|
|
|
357
357
|
if (value.type === "wellknown") {
|
|
358
358
|
const url = key.replace(/\/+$/, "")
|
|
359
359
|
authEnv[value.key] = value.token
|
|
360
|
-
const wellknownURL = `${url}/.well-known/
|
|
360
|
+
const wellknownURL = `${url}/.well-known/anymous`
|
|
361
361
|
yield* Effect.logDebug("fetching remote config", { url: wellknownURL })
|
|
362
362
|
const wellknown = yield* fetchRemoteJson(wellknownURL, undefined, ConfigV1.WellKnown, url)
|
|
363
363
|
const remote = yield* Effect.promise(() =>
|
|
@@ -380,7 +380,7 @@ const layer = Layer.effect(
|
|
|
380
380
|
})
|
|
381
381
|
: {}
|
|
382
382
|
const remoteConfig = mergeConfig(isRecord(wellknown.config) ? wellknown.config : {}, fetchedConfig)
|
|
383
|
-
if (!remoteConfig.$schema) remoteConfig.$schema = "https://
|
|
383
|
+
if (!remoteConfig.$schema) remoteConfig.$schema = "https://anymous-cli.vercel.app/config.json"
|
|
384
384
|
const source = wellknownURL
|
|
385
385
|
const next = yield* loadConfig(
|
|
386
386
|
JSON.stringify(remoteConfig),
|
|
@@ -398,13 +398,13 @@ const layer = Layer.effect(
|
|
|
398
398
|
const global = Object.keys(authEnv).length ? yield* loadGlobal(authEnv) : yield* getGlobal()
|
|
399
399
|
yield* merge(Global.Path.config, global, "global")
|
|
400
400
|
|
|
401
|
-
if (Flag.
|
|
402
|
-
yield* merge(Flag.
|
|
403
|
-
yield* Effect.logDebug("loaded custom config", { path: Flag.
|
|
401
|
+
if (Flag.ANYMOUS_CONFIG) {
|
|
402
|
+
yield* merge(Flag.ANYMOUS_CONFIG, yield* loadFile(Flag.ANYMOUS_CONFIG, authEnv))
|
|
403
|
+
yield* Effect.logDebug("loaded custom config", { path: Flag.ANYMOUS_CONFIG })
|
|
404
404
|
}
|
|
405
405
|
|
|
406
|
-
if (!Flag.
|
|
407
|
-
for (const file of yield* ConfigPaths.files("
|
|
406
|
+
if (!Flag.ANYMOUS_DISABLE_PROJECT_CONFIG) {
|
|
407
|
+
for (const file of yield* ConfigPaths.files("anymous", ctx.directory, ctx.worktree).pipe(Effect.orDie)) {
|
|
408
408
|
yield* merge(file, yield* loadFile(file, authEnv), "local")
|
|
409
409
|
}
|
|
410
410
|
}
|
|
@@ -415,15 +415,15 @@ const layer = Layer.effect(
|
|
|
415
415
|
|
|
416
416
|
const directories = yield* ConfigPaths.directories(ctx.directory, ctx.worktree)
|
|
417
417
|
|
|
418
|
-
if (Flag.
|
|
419
|
-
yield* Effect.logDebug("loading config from
|
|
418
|
+
if (Flag.ANYMOUS_CONFIG_DIR) {
|
|
419
|
+
yield* Effect.logDebug("loading config from ANYMOUS_CONFIG_DIR", { path: Flag.ANYMOUS_CONFIG_DIR })
|
|
420
420
|
}
|
|
421
421
|
|
|
422
422
|
const deps: Fiber.Fiber<void>[] = []
|
|
423
423
|
|
|
424
424
|
for (const dir of directories) {
|
|
425
|
-
if (dir.endsWith(".
|
|
426
|
-
for (const file of ["
|
|
425
|
+
if (dir.endsWith(".anymous") || dir === Flag.ANYMOUS_CONFIG_DIR) {
|
|
426
|
+
for (const file of ["anymous.json", "anymous.jsonc"]) {
|
|
427
427
|
const source = path.join(dir, file)
|
|
428
428
|
yield* Effect.logDebug(`loading config from ${source}`)
|
|
429
429
|
yield* merge(source, yield* loadFile(source, authEnv))
|
|
@@ -439,7 +439,7 @@ const layer = Layer.effect(
|
|
|
439
439
|
.install(dir, {
|
|
440
440
|
add: [
|
|
441
441
|
{
|
|
442
|
-
name: "@
|
|
442
|
+
name: "@anymous-ai/plugin",
|
|
443
443
|
version: InstallationLocal ? undefined : InstallationVersion,
|
|
444
444
|
},
|
|
445
445
|
],
|
|
@@ -459,20 +459,20 @@ const layer = Layer.effect(
|
|
|
459
459
|
result.command = mergeDeep(result.command ?? {}, yield* Effect.promise(() => ConfigCommand.load(dir)))
|
|
460
460
|
result.agent = mergeDeep(result.agent ?? {}, yield* Effect.promise(() => ConfigAgent.load(dir)))
|
|
461
461
|
result.agent = mergeDeep(result.agent ?? {}, yield* Effect.promise(() => ConfigAgent.loadMode(dir)))
|
|
462
|
-
// Auto-discovered plugins under `.
|
|
462
|
+
// Auto-discovered plugins under `.anymous/plugin(s)` are already local files, so ConfigPlugin.load
|
|
463
463
|
// returns normalized Specs and we only need to attach origin metadata here.
|
|
464
464
|
const list = yield* Effect.promise(() => ConfigPlugin.load(dir))
|
|
465
465
|
yield* mergePluginOrigins(dir, list)
|
|
466
466
|
}
|
|
467
467
|
|
|
468
|
-
if (process.env.
|
|
469
|
-
const source = "
|
|
470
|
-
const next = yield* loadConfig(process.env.
|
|
468
|
+
if (process.env.ANYMOUS_CONFIG_CONTENT) {
|
|
469
|
+
const source = "ANYMOUS_CONFIG_CONTENT"
|
|
470
|
+
const next = yield* loadConfig(process.env.ANYMOUS_CONFIG_CONTENT, {
|
|
471
471
|
dir: ctx.directory,
|
|
472
472
|
source,
|
|
473
473
|
})
|
|
474
474
|
yield* merge(source, next, "local")
|
|
475
|
-
yield* Effect.logDebug("loaded custom config from
|
|
475
|
+
yield* Effect.logDebug("loaded custom config from ANYMOUS_CONFIG_CONTENT")
|
|
476
476
|
}
|
|
477
477
|
|
|
478
478
|
const activeAccount = Option.getOrUndefined(
|
|
@@ -488,8 +488,8 @@ const layer = Layer.effect(
|
|
|
488
488
|
{ concurrency: 2 },
|
|
489
489
|
)
|
|
490
490
|
if (Option.isSome(tokenOpt)) {
|
|
491
|
-
process.env["
|
|
492
|
-
yield* env.set("
|
|
491
|
+
process.env["ANYMOUS_CONSOLE_TOKEN"] = tokenOpt.value
|
|
492
|
+
yield* env.set("ANYMOUS_CONSOLE_TOKEN", tokenOpt.value)
|
|
493
493
|
}
|
|
494
494
|
|
|
495
495
|
if (Option.isSome(configOpt)) {
|
|
@@ -515,7 +515,7 @@ const layer = Layer.effect(
|
|
|
515
515
|
|
|
516
516
|
const managedDir = ConfigManaged.managedConfigDir()
|
|
517
517
|
if (existsSync(managedDir)) {
|
|
518
|
-
for (const file of ["
|
|
518
|
+
for (const file of ["anymous.json", "anymous.jsonc"]) {
|
|
519
519
|
const source = path.join(managedDir, file)
|
|
520
520
|
yield* merge(source, yield* loadFile(source), "global")
|
|
521
521
|
}
|
|
@@ -542,11 +542,11 @@ const layer = Layer.effect(
|
|
|
542
542
|
})
|
|
543
543
|
}
|
|
544
544
|
|
|
545
|
-
if (Flag.
|
|
545
|
+
if (Flag.ANYMOUS_PERMISSION) {
|
|
546
546
|
try {
|
|
547
|
-
result.permission = mergeDeep(result.permission ?? {}, JSON.parse(Flag.
|
|
547
|
+
result.permission = mergeDeep(result.permission ?? {}, JSON.parse(Flag.ANYMOUS_PERMISSION))
|
|
548
548
|
} catch (err) {
|
|
549
|
-
yield* Effect.logWarning("
|
|
549
|
+
yield* Effect.logWarning("ANYMOUS_PERMISSION contains invalid JSON, skipping", { err })
|
|
550
550
|
}
|
|
551
551
|
}
|
|
552
552
|
|
|
@@ -576,10 +576,10 @@ const layer = Layer.effect(
|
|
|
576
576
|
result.share = "auto"
|
|
577
577
|
}
|
|
578
578
|
|
|
579
|
-
if (Flag.
|
|
579
|
+
if (Flag.ANYMOUS_DISABLE_AUTOCOMPACT) {
|
|
580
580
|
result.compaction = { ...result.compaction, auto: false }
|
|
581
581
|
}
|
|
582
|
-
if (Flag.
|
|
582
|
+
if (Flag.ANYMOUS_DISABLE_PRUNE) {
|
|
583
583
|
result.compaction = { ...result.compaction, prune: false }
|
|
584
584
|
}
|
|
585
585
|
|
package/src/config/managed.ts
CHANGED
|
@@ -5,9 +5,9 @@ import os from "os"
|
|
|
5
5
|
import path from "path"
|
|
6
6
|
import { Process } from "@/util/process"
|
|
7
7
|
|
|
8
|
-
const MANAGED_PLIST_DOMAIN = "ai.
|
|
8
|
+
const MANAGED_PLIST_DOMAIN = "ai.anymous.managed"
|
|
9
9
|
|
|
10
|
-
// Keys injected by macOS/MDM into the managed plist that are not
|
|
10
|
+
// Keys injected by macOS/MDM into the managed plist that are not anymous config
|
|
11
11
|
const PLIST_META = new Set([
|
|
12
12
|
"PayloadDisplayName",
|
|
13
13
|
"PayloadIdentifier",
|
|
@@ -20,16 +20,16 @@ const PLIST_META = new Set([
|
|
|
20
20
|
function systemManagedConfigDir(): string {
|
|
21
21
|
switch (process.platform) {
|
|
22
22
|
case "darwin":
|
|
23
|
-
return "/Library/Application Support/
|
|
23
|
+
return "/Library/Application Support/anymous"
|
|
24
24
|
case "win32":
|
|
25
|
-
return path.join(process.env.ProgramData || "C:\\ProgramData", "
|
|
25
|
+
return path.join(process.env.ProgramData || "C:\\ProgramData", "anymous")
|
|
26
26
|
default:
|
|
27
|
-
return "/etc/
|
|
27
|
+
return "/etc/anymous"
|
|
28
28
|
}
|
|
29
29
|
}
|
|
30
30
|
|
|
31
31
|
export function managedConfigDir() {
|
|
32
|
-
return process.env.
|
|
32
|
+
return process.env.ANYMOUS_TEST_MANAGED_CONFIG_DIR || systemManagedConfigDir()
|
|
33
33
|
}
|
|
34
34
|
|
|
35
35
|
export function parseManagedPlist(json: string): string {
|
package/src/config/markdown.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Filesystem } from "@/util/filesystem"
|
|
2
|
-
import { FrontmatterError } from "@
|
|
3
|
-
import { ConfigMarkdown as ConfigMarkdownCore } from "@
|
|
2
|
+
import { FrontmatterError } from "@anymous-ai/core/v1/config/error"
|
|
3
|
+
import { ConfigMarkdown as ConfigMarkdownCore } from "@anymous-ai/core/config/markdown"
|
|
4
4
|
|
|
5
5
|
export const FILE_REGEX = /(?<![\w`])@(\.?[^\s`,.]*(?:\.[^\s`,.]+)*)/g
|
|
6
6
|
export const SHELL_REGEX = /!`([^`]+)`/g
|
package/src/config/parse.ts
CHANGED
|
@@ -2,8 +2,8 @@ export * as ConfigParse from "./parse"
|
|
|
2
2
|
|
|
3
3
|
import { type ParseError as JsoncParseError, parse as parseJsoncImpl, printParseErrorCode } from "jsonc-parser"
|
|
4
4
|
import { Cause, Exit, Schema as EffectSchema, SchemaIssue } from "effect"
|
|
5
|
-
import type { DeepMutable } from "@
|
|
6
|
-
import { InvalidError, JsonError } from "@
|
|
5
|
+
import type { DeepMutable } from "@anymous-ai/core/schema"
|
|
6
|
+
import { InvalidError, JsonError } from "@anymous-ai/core/v1/config/error"
|
|
7
7
|
|
|
8
8
|
export function jsonc(text: string, filepath: string): unknown {
|
|
9
9
|
const errors: JsoncParseError[] = []
|
package/src/config/paths.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
export * as ConfigPaths from "./paths"
|
|
2
2
|
|
|
3
3
|
import path from "path"
|
|
4
|
-
import { Flag } from "@
|
|
5
|
-
import { Global } from "@
|
|
4
|
+
import { Flag } from "@anymous-ai/core/flag/flag"
|
|
5
|
+
import { Global } from "@anymous-ai/core/global"
|
|
6
6
|
import { unique } from "remeda"
|
|
7
7
|
import * as Effect from "effect/Effect"
|
|
8
|
-
import { FSUtil } from "@
|
|
8
|
+
import { FSUtil } from "@anymous-ai/core/fs-util"
|
|
9
9
|
|
|
10
10
|
export const files = Effect.fn("ConfigPaths.projectFiles")(function* (
|
|
11
11
|
name: string,
|
|
@@ -24,19 +24,19 @@ export const directories = Effect.fn("ConfigPaths.directories")(function* (direc
|
|
|
24
24
|
const afs = yield* FSUtil.Service
|
|
25
25
|
return unique([
|
|
26
26
|
Global.Path.config,
|
|
27
|
-
...(!Flag.
|
|
27
|
+
...(!Flag.ANYMOUS_DISABLE_PROJECT_CONFIG
|
|
28
28
|
? yield* afs.up({
|
|
29
|
-
targets: [".
|
|
29
|
+
targets: [".anymous"],
|
|
30
30
|
start: directory,
|
|
31
31
|
stop: worktree,
|
|
32
32
|
})
|
|
33
33
|
: []),
|
|
34
34
|
...(yield* afs.up({
|
|
35
|
-
targets: [".
|
|
35
|
+
targets: [".anymous"],
|
|
36
36
|
start: Global.Path.home,
|
|
37
37
|
stop: Global.Path.home,
|
|
38
38
|
})),
|
|
39
|
-
...(Flag.
|
|
39
|
+
...(Flag.ANYMOUS_CONFIG_DIR ? [Flag.ANYMOUS_CONFIG_DIR] : []),
|
|
40
40
|
])
|
|
41
41
|
})
|
|
42
42
|
|
package/src/config/plugin.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Glob } from "@
|
|
2
|
-
import { ConfigPluginV1 } from "@
|
|
1
|
+
import { Glob } from "@anymous-ai/core/util/glob"
|
|
2
|
+
import { ConfigPluginV1 } from "@anymous-ai/core/v1/config/plugin"
|
|
3
3
|
import { pathToFileURL } from "url"
|
|
4
4
|
import { isPathPluginSpec, parsePluginSpecifier, resolvePathPluginTarget } from "@/plugin/shared"
|
|
5
5
|
import path from "path"
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { TuiConfig } from "@
|
|
2
|
-
import { isRecord } from "@
|
|
1
|
+
import { TuiConfig } from "@anymous-ai/tui/config"
|
|
2
|
+
import { isRecord } from "@anymous-ai/tui/util/record"
|
|
3
3
|
import { Filesystem } from "@/util/filesystem"
|
|
4
4
|
import { Schema } from "effect"
|
|
5
5
|
|
|
@@ -2,13 +2,13 @@ import path from "path"
|
|
|
2
2
|
import { type ParseError as JsoncParseError, applyEdits, modify, parse as parseJsonc } from "jsonc-parser"
|
|
3
3
|
import { unique } from "remeda"
|
|
4
4
|
import { Option, Schema } from "effect"
|
|
5
|
-
import { TuiConfig } from "@
|
|
6
|
-
import { Flag } from "@
|
|
7
|
-
import { Global } from "@
|
|
5
|
+
import { TuiConfig } from "@anymous-ai/tui/config"
|
|
6
|
+
import { Flag } from "@anymous-ai/core/flag/flag"
|
|
7
|
+
import { Global } from "@anymous-ai/core/global"
|
|
8
8
|
import { Filesystem } from "@/util/filesystem"
|
|
9
9
|
import * as ConfigPaths from "@/config/paths"
|
|
10
10
|
|
|
11
|
-
const TUI_SCHEMA_URL = "https://
|
|
11
|
+
const TUI_SCHEMA_URL = "https://anymous-cli.vercel.app/tui.json"
|
|
12
12
|
|
|
13
13
|
const decodeTheme = Schema.decodeUnknownOption(Schema.String)
|
|
14
14
|
const decodeRecord = Schema.decodeUnknownOption(Schema.Record(Schema.String, Schema.Unknown))
|
|
@@ -22,13 +22,13 @@ interface MigrateInput {
|
|
|
22
22
|
}
|
|
23
23
|
|
|
24
24
|
/**
|
|
25
|
-
* Migrates tui-specific keys (theme, keybinds, tui) from
|
|
25
|
+
* Migrates tui-specific keys (theme, keybinds, tui) from anymous.json files
|
|
26
26
|
* into dedicated tui.json files. Migration is performed per-directory and
|
|
27
27
|
* skips only locations where a tui.json already exists.
|
|
28
28
|
*/
|
|
29
29
|
export async function migrateTuiConfig(input: MigrateInput) {
|
|
30
|
-
const
|
|
31
|
-
for (const file of
|
|
30
|
+
const anymous = await anymousFiles(input)
|
|
31
|
+
for (const file of anymous) {
|
|
32
32
|
const source = await Filesystem.readText(file).catch(() => undefined)
|
|
33
33
|
if (!source) continue
|
|
34
34
|
const errors: JsoncParseError[] = []
|
|
@@ -112,15 +112,15 @@ async function backupAndStripLegacy(file: string, source: string) {
|
|
|
112
112
|
.catch(() => false)
|
|
113
113
|
}
|
|
114
114
|
|
|
115
|
-
async function
|
|
115
|
+
async function anymousFiles(input: { directories: string[]; cwd: string }) {
|
|
116
116
|
const files = [
|
|
117
|
-
...ConfigPaths.fileInDirectory(Global.Path.config, "
|
|
118
|
-
...(await Filesystem.findUp(["
|
|
117
|
+
...ConfigPaths.fileInDirectory(Global.Path.config, "anymous"),
|
|
118
|
+
...(await Filesystem.findUp(["anymous.json", "anymous.jsonc"], input.cwd, undefined, { rootFirst: true })),
|
|
119
119
|
]
|
|
120
120
|
for (const dir of unique(input.directories)) {
|
|
121
|
-
files.push(...ConfigPaths.fileInDirectory(dir, "
|
|
121
|
+
files.push(...ConfigPaths.fileInDirectory(dir, "anymous"))
|
|
122
122
|
}
|
|
123
|
-
if (Flag.
|
|
123
|
+
if (Flag.ANYMOUS_CONFIG) files.push(Flag.ANYMOUS_CONFIG)
|
|
124
124
|
|
|
125
125
|
const existing = await Promise.all(
|
|
126
126
|
unique(files).map(async (file) => {
|