@agimon-ai/po-config 0.0.0-alpha.6 → 0.0.0-alpha.7
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/dist/index-nVcEC1jO.d.mts.map +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.mjs +1 -1
- package/dist/{init-1Iwjz2pM.cjs → init-BdZ-gqqk.cjs} +34 -32
- package/dist/init-BdZ-gqqk.cjs.map +1 -0
- package/dist/{init-BqWnULlD.mjs → init-DG7MxGxC.mjs} +34 -32
- package/dist/init-DG7MxGxC.mjs.map +1 -0
- package/dist/init.cjs +1 -1
- package/dist/init.mjs +1 -1
- package/package.json +5 -5
- package/dist/init-1Iwjz2pM.cjs.map +0 -1
- package/dist/init-BqWnULlD.mjs.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index-nVcEC1jO.d.mts","names":[],"sources":["../src/services/init/templates.ts","../src/services/init/sync.ts","../src/services/init/index.ts"],"mappings":";;;cAOa;KAED,qBAAqB;;cAGpB,qBAAqB,SAAS,OAAO;;
|
|
1
|
+
{"version":3,"file":"index-nVcEC1jO.d.mts","names":[],"sources":["../src/services/init/templates.ts","../src/services/init/sync.ts","../src/services/init/index.ts"],"mappings":";;;cAOa;KAED,qBAAqB;;cAGpB,qBAAqB,SAAS,OAAO;;cAsNrC,gCAAgC,SAAS,OAAO;;UA0F5C;EACf;EACA;EACA;;EAEA;;UAGe;;;;;;;EAOf;;KAGU,0BAA0B;KAC1B,yBAAyB;;;;;;;;;;;;;iBCjJrB,yBACd,wBACA,UAAS,sBACR;;;;;;iBAea,6BACd,yBACA,UAAS,0BACR;;;KCxLE,YAAY,WAAW;;;;;;;iBA6FZ,8BACd,IAAI,YACJ,SAAS,WACT,wBACA,UAAS,sBACR,QAAQ;;iBAaK,kCACd,IAAI,YACJ,wBACA,SAAS,WACT,UAAS,0BACR,QAAQ"}
|
package/dist/index.cjs
CHANGED
|
@@ -10,7 +10,7 @@ const require_domains = require("./domains-CiDUsRiX.cjs");
|
|
|
10
10
|
const require_harnessState = require("./harnessState-BrmH0lG5.cjs");
|
|
11
11
|
const require_harnessStore = require("./harnessStore-BinxGITh.cjs");
|
|
12
12
|
const require_piConfig = require("./piConfig-cluCie5i.cjs");
|
|
13
|
-
const require_init = require("./init-
|
|
13
|
+
const require_init = require("./init-BdZ-gqqk.cjs");
|
|
14
14
|
const require_majorModes = require("./majorModes-Ctsdi8QW.cjs");
|
|
15
15
|
const require_profiles = require("./profiles-t2EUj0aB.cjs");
|
|
16
16
|
require("./config-zZz80Mh5.cjs");
|
package/dist/index.mjs
CHANGED
|
@@ -9,7 +9,7 @@ import { _ as findPluginManifestPathAsync, b as isRemotePluginSource, c as resol
|
|
|
9
9
|
import { i as readHarnessState, n as HARNESS_STATE_KEYS, r as projectHarnessEnvironment, t as FILE_ONLY_STATE_FIELDS } from "./harnessState-8lZda_8r.mjs";
|
|
10
10
|
import { _ as HARNESS_STATE_POINTER, a as requireHarnessPaths, d as getHarnessState, f as getSessionHarnessState, g as updateHarnessState, h as snapshotHarnessState, l as createHarnessSession, m as restoreHarnessStateSnapshot, o as requireHarnessRoot, p as loadHarnessState, r as harnessRoot, u as disposeHarnessState, v as resetHarnessStore } from "./harnessStore-w8zHmJ_H.mjs";
|
|
11
11
|
import { a as loadPiConfigAsync, c as piConfigPaths, d as MIN_IMAGE_MAX_DIMENSION, f as clampImageMaxDimension, i as loadPiConfig, l as piImageSettingsPath, o as loadPiImageSettings, p as parsePiImageSettings, s as savePiImageSettings, u as DEFAULT_IMAGE_MAX_DIMENSION } from "./piConfig-Bq36PQFF.mjs";
|
|
12
|
-
import { a as GLOBAL_PO_SEED_FILES, i as initializeRepositoryPoConfig, o as PO_CONFIG_TEMPLATES, r as initializeGlobalPoConfig, s as REPOSITORY_PO_CONFIG_TEMPLATES } from "./init-
|
|
12
|
+
import { a as GLOBAL_PO_SEED_FILES, i as initializeRepositoryPoConfig, o as PO_CONFIG_TEMPLATES, r as initializeGlobalPoConfig, s as REPOSITORY_PO_CONFIG_TEMPLATES } from "./init-DG7MxGxC.mjs";
|
|
13
13
|
import { c as layerHookGroups, i as loadMajorModesConfigLenient, l as resolveLayers, o as isLocalPackageSpecifier, r as loadMajorModesConfig, s as layerEntries, u as resolvePackageConfigurations } from "./majorModes-Ddx975MG.mjs";
|
|
14
14
|
import { d as PERSONA_FILES, f as applyProfileEnvironment, l as loadProfiles, o as buildPersonaPrompt, p as replaceProfileEnvironment, s as listProfileNames, u as resolveProfile } from "./profiles-CHict0x-.mjs";
|
|
15
15
|
import { t as PO_CONFIG_SERVICE } from "./config-BBvn_ZLP.mjs";
|
|
@@ -84,13 +84,14 @@ default:
|
|
|
84
84
|
- '@agimon-ai/po-autocompact'
|
|
85
85
|
- '@agimon-ai/po-loop'
|
|
86
86
|
- '@agimon-ai/po-plan'
|
|
87
|
+
- '@agimon-ai/po-author'
|
|
88
|
+
- '@agimon-ai/po-computer-use'
|
|
87
89
|
- '@agimon-ai/po-workflow'
|
|
88
90
|
- '@agimon-ai/po-log'
|
|
89
91
|
- '@agimon-ai/po-mcp'
|
|
90
|
-
- '@agimon-ai/po-template-elegant'
|
|
91
92
|
- '@agimon-ai/po-prompt'
|
|
92
|
-
- '@agimon-ai/po-
|
|
93
|
-
- '@agimon-ai/po-
|
|
93
|
+
- '@agimon-ai/po-template-advanced'
|
|
94
|
+
- '@agimon-ai/po-template-elegant'
|
|
94
95
|
layers:
|
|
95
96
|
team:
|
|
96
97
|
packages:
|
|
@@ -109,30 +110,27 @@ layers:
|
|
|
109
110
|
task:
|
|
110
111
|
packages:
|
|
111
112
|
- '@agimon-ai/po-task'
|
|
112
|
-
|
|
113
|
+
sandbox:
|
|
113
114
|
packages:
|
|
114
|
-
- '@agimon-ai/po-
|
|
115
|
+
- '@agimon-ai/po-sandbox'
|
|
115
116
|
design:
|
|
116
117
|
packages:
|
|
117
118
|
- '@agimon-ai/po-style-system'
|
|
118
|
-
image-gen:
|
|
119
|
-
packages:
|
|
120
|
-
- '@agimon-ai/po-image-gen'
|
|
121
119
|
llm:
|
|
122
120
|
packages:
|
|
123
121
|
- '@agimon-ai/po-model-guidance'
|
|
124
|
-
sandbox:
|
|
125
|
-
packages:
|
|
126
|
-
- '@agimon-ai/po-sandbox'
|
|
127
122
|
source-control:
|
|
128
123
|
packages:
|
|
129
124
|
- '@agimon-ai/po-git'
|
|
130
|
-
|
|
125
|
+
image-gen:
|
|
131
126
|
packages:
|
|
132
|
-
- '@agimon-ai/po-
|
|
127
|
+
- '@agimon-ai/po-image-gen'
|
|
133
128
|
web-search:
|
|
134
129
|
packages:
|
|
135
130
|
- '@agimon-ai/po-web-search'
|
|
131
|
+
browser:
|
|
132
|
+
packages:
|
|
133
|
+
- '@agimon-ai/po-browse'
|
|
136
134
|
# A major mode explains when it should be used and names its ordered layers.
|
|
137
135
|
# Add another entry under majorMode, then select it with
|
|
138
136
|
# po --major-mode <name>. Change defaultMajorMode to make it the default.
|
|
@@ -140,10 +138,13 @@ defaultMajorMode: copilot
|
|
|
140
138
|
majorMode:
|
|
141
139
|
minimal:
|
|
142
140
|
description: Lean mode with Team delegation and persistent tasks.
|
|
143
|
-
layers: [team, task]
|
|
141
|
+
layers: [team, task, llm]
|
|
144
142
|
copilot:
|
|
145
|
-
description: General-purpose coding mode with
|
|
146
|
-
layers: [team, ask-user, task,
|
|
143
|
+
description: General-purpose coding mode with delegation, persistent tasks, supervised commands, and structured user feedback.
|
|
144
|
+
layers: [team, ask-user, task, sandbox, llm, source-control, design, image-gen, web-search, browser]
|
|
145
|
+
examples:
|
|
146
|
+
description: Layer-free base mode for the repository's plugin and workflow examples.
|
|
147
|
+
layers: []
|
|
147
148
|
# review:
|
|
148
149
|
# description: Focused review mode for inspecting changes and reporting risks.
|
|
149
150
|
# layers: [team, task, ask-user]
|
|
@@ -248,13 +249,14 @@ default:
|
|
|
248
249
|
- '@agimon-ai/po-autocompact'
|
|
249
250
|
- '@agimon-ai/po-loop'
|
|
250
251
|
- '@agimon-ai/po-plan'
|
|
252
|
+
- '@agimon-ai/po-author'
|
|
253
|
+
- '@agimon-ai/po-computer-use'
|
|
251
254
|
- '@agimon-ai/po-workflow'
|
|
252
255
|
- '@agimon-ai/po-log'
|
|
253
256
|
- '@agimon-ai/po-mcp'
|
|
254
|
-
- '@agimon-ai/po-template-elegant'
|
|
255
257
|
- '@agimon-ai/po-prompt'
|
|
256
|
-
- '@agimon-ai/po-
|
|
257
|
-
- '@agimon-ai/po-
|
|
258
|
+
- '@agimon-ai/po-template-advanced'
|
|
259
|
+
- '@agimon-ai/po-template-elegant'
|
|
258
260
|
layers:
|
|
259
261
|
team:
|
|
260
262
|
packages:
|
|
@@ -265,38 +267,38 @@ layers:
|
|
|
265
267
|
task:
|
|
266
268
|
packages:
|
|
267
269
|
- '@agimon-ai/po-task'
|
|
268
|
-
|
|
270
|
+
sandbox:
|
|
269
271
|
packages:
|
|
270
|
-
- '@agimon-ai/po-
|
|
272
|
+
- '@agimon-ai/po-sandbox'
|
|
271
273
|
design:
|
|
272
274
|
packages:
|
|
273
275
|
- '@agimon-ai/po-style-system'
|
|
274
|
-
image-gen:
|
|
275
|
-
packages:
|
|
276
|
-
- '@agimon-ai/po-image-gen'
|
|
277
276
|
llm:
|
|
278
277
|
packages:
|
|
279
278
|
- '@agimon-ai/po-model-guidance'
|
|
280
|
-
sandbox:
|
|
281
|
-
packages:
|
|
282
|
-
- '@agimon-ai/po-sandbox'
|
|
283
279
|
source-control:
|
|
284
280
|
packages:
|
|
285
281
|
- '@agimon-ai/po-git'
|
|
286
|
-
|
|
282
|
+
image-gen:
|
|
287
283
|
packages:
|
|
288
|
-
- '@agimon-ai/po-
|
|
284
|
+
- '@agimon-ai/po-image-gen'
|
|
289
285
|
web-search:
|
|
290
286
|
packages:
|
|
291
287
|
- '@agimon-ai/po-web-search'
|
|
288
|
+
browser:
|
|
289
|
+
packages:
|
|
290
|
+
- '@agimon-ai/po-browse'
|
|
292
291
|
defaultMajorMode: copilot
|
|
293
292
|
majorMode:
|
|
294
293
|
minimal:
|
|
295
294
|
description: Lean mode with Team delegation and persistent tasks.
|
|
296
|
-
layers: [team, task]
|
|
295
|
+
layers: [team, task, llm]
|
|
297
296
|
copilot:
|
|
298
297
|
description: General-purpose coding mode with delegation, persistent tasks, supervised commands, and structured user feedback.
|
|
299
|
-
layers: [team, ask-user, task,
|
|
298
|
+
layers: [team, ask-user, task, sandbox, llm, source-control, design, image-gen, web-search, browser]
|
|
299
|
+
examples:
|
|
300
|
+
description: Layer-free base mode for the repository's plugin and workflow examples.
|
|
301
|
+
layers: []
|
|
300
302
|
`,
|
|
301
303
|
"domains.yaml": `# Repository-local plugin catalog and domain selection.
|
|
302
304
|
defaultDomains: [default]
|
|
@@ -593,4 +595,4 @@ Object.defineProperty(exports, "initializeRepositoryPoConfigAsync", {
|
|
|
593
595
|
}
|
|
594
596
|
});
|
|
595
597
|
|
|
596
|
-
//# sourceMappingURL=init-
|
|
598
|
+
//# sourceMappingURL=init-BdZ-gqqk.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"init-BdZ-gqqk.cjs","names":["ensureDirectory","fs","path","classifyTarget","nodeHost","randomUUID","initializePoConfig","globalPoConfigDirectory","createSerialRunner","nodeHost","getOrThrow","writeFileAtomic","path","globalPoConfigDirectory"],"sources":["../src/services/init/templates.ts","../src/services/init/sync.ts","../src/services/init/index.ts"],"sourcesContent":["export const PRIVATE_DIRECTORY_MODE = 0o700;\nexport const PRIVATE_FILE_MODE = 0o600;\nexport const REPOSITORY_DIRECTORY_MODE = 0o755;\nexport const REPOSITORY_FILE_MODE = 0o644;\nexport const PO_DIRECTORY = '.po';\n\n/** The global seed files are processed in this fixed order. */\nexport const GLOBAL_PO_SEED_FILES = ['config.yaml', 'modes.yaml', 'domains.yaml', 'profiles.yaml'] as const;\n\nexport type PoSeedFile = (typeof GLOBAL_PO_SEED_FILES)[number];\n\n/** Portable defaults for a new global Po configuration directory. */\nexport const PO_CONFIG_TEMPLATES: Readonly<Record<PoSeedFile, string>> = {\n 'config.yaml': `projectTrust: ask\n\n# Autonomous voice is opt-in and uses an explicitly configured Pi model.\n# voice:\n# autoCapture:\n# model: provider/model-id\n# startPhrases:\n# - hey po\n# stopPhrases:\n# - stop speaking\n# utteranceIdleMs: 3000\n# # Long prompts only: open a draft, keep talking, then send it in one piece.\n# # Short utterances are delivered as you finish them and need no phrase.\n# composeOpenPhrases:\n# - hey po\n# composeSendPhrases:\n# - that's it\n# composeCancelPhrases:\n# - scratch that\n# # Endpoint window while a draft collects, so a short command lands on its own.\n# composeUtteranceIdleMs: 1200\n# # Silence before Voice reminds you a draft is open. 0 turns the reminder off.\n# composeNudgeMs: 10000\n# tts:\n# engine: macos-say\n# voice: Samantha\n# rate: 190\n`,\n 'modes.yaml': `# A layer is a reusable named bundle of packages, built-in or local extensions,\n# and hook groups. Major modes below choose which layers load together for a session.\n#\n# Layers and modes defined here apply to every repository. A repository's own\n# .po/modes.yaml is read after this file and replaces any layer or mode of the\n# same name, so a repository can override one entry without restating the rest.\n#\n# Add a layer by giving it a unique name under layers. Local Pi scripts belong\n# under extensions, while installed Pi packages belong under packages:\n# review-tools:\n# extensions:\n# - './extensions/local-review.ts'\n# packages:\n# - '@scope/review-extension'\n# A bare extension name selects a Po built-in. A path beginning with ./ or\n# ../ loads a custom script or extension directory. A bare package loads its\n# ordered package.json pi.extensions entries, while an exported subpath selects\n# one adapter. Relative paths resolve beside this file here (~/.po), or\n# from the repository root in .po/modes.yaml.\n#\n# Use a package mapping when that package accepts configuration. Configuration\n# belongs under the package entry that consumes it, not beside packages.\n# The top-level default bundle loads before every major mode. Replace this whole\n# packages list to customize the distribution defaults. Po core packages\n# remain active independently of this list.\ndefault:\n packages:\n - '@agimon-ai/po-help'\n - '@agimon-ai/po-hook'\n - '@agimon-ai/po-goal'\n - '@agimon-ai/po-voice'\n - '@agimon-ai/po-runner'\n - '@agimon-ai/po-read'\n - '@agimon-ai/po-grep'\n - '@agimon-ai/po-edit'\n - '@agimon-ai/po-file-edit'\n - '@agimon-ai/po-autocompact'\n - '@agimon-ai/po-loop'\n - '@agimon-ai/po-plan'\n - '@agimon-ai/po-author'\n - '@agimon-ai/po-computer-use'\n - '@agimon-ai/po-workflow'\n - '@agimon-ai/po-log'\n - '@agimon-ai/po-mcp'\n - '@agimon-ai/po-prompt'\n - '@agimon-ai/po-template-advanced'\n - '@agimon-ai/po-template-elegant'\nlayers:\n team:\n packages:\n - name: '@agimon-ai/po-team'\n # Optional Team configuration. Uncomment and choose models available to Pi.\n # config:\n # models:\n # - model: openai-codex/gpt-5.6-luna\n # thinking: xhigh\n # # Tool names excluded from subagents launched by this package. These\n # # remove model-visible tools while preserving hidden team transport.\n # excludeTools: [ask_user_question, intercom, subagent]\n ask-user:\n packages:\n - '@agimon-ai/po-user-feedback'\n task:\n packages:\n - '@agimon-ai/po-task'\n sandbox:\n packages:\n - '@agimon-ai/po-sandbox'\n design:\n packages:\n - '@agimon-ai/po-style-system'\n llm:\n packages:\n - '@agimon-ai/po-model-guidance'\n source-control:\n packages:\n - '@agimon-ai/po-git'\n image-gen:\n packages:\n - '@agimon-ai/po-image-gen'\n web-search:\n packages:\n - '@agimon-ai/po-web-search'\n browser:\n packages:\n - '@agimon-ai/po-browse'\n# A major mode explains when it should be used and names its ordered layers.\n# Add another entry under majorMode, then select it with\n# po --major-mode <name>. Change defaultMajorMode to make it the default.\ndefaultMajorMode: copilot\nmajorMode:\n minimal:\n description: Lean mode with Team delegation and persistent tasks.\n layers: [team, task, llm]\n copilot:\n description: General-purpose coding mode with delegation, persistent tasks, supervised commands, and structured user feedback.\n layers: [team, ask-user, task, sandbox, llm, source-control, design, image-gen, web-search, browser]\n examples:\n description: Layer-free base mode for the repository's plugin and workflow examples.\n layers: []\n # review:\n # description: Focused review mode for inspecting changes and reporting risks.\n # layers: [team, task, ask-user]\n`,\n 'domains.yaml': `# Plugins are named once in this catalog, then selected by one or more domains.\n# Po automatically inspects personal and repository Codex marketplaces.\n# Each configured root may also be a folder whose direct children are plugins;\n# use roots: [plugins] to discover a repository plugin folder without one entry\n# per plugin. Discovery never scans recursively.\ndefaultDomains: [default]\nplugins:\n roots: []\n entries: {}\n # Local paths resolve beside this file in ~/.po. Repository paths in a\n # repository .po/domains.yaml resolve from that repository root.\n # entries:\n # development:\n # source: local\n # path: plugins/development\n # remote-review:\n # source: url\n # url: https://github.com/acme/review-plugin.git\n # ref: v1.2.0\n # published-review:\n # source: npm\n # package: '@acme/review-plugin'\n # version: 1.2.0\n# Domains carry descriptions and refer to catalog names, not filesystem paths.\ndomains:\n default:\n description: Shared skills and repository MCP only.\n plugins: []\n # development:\n # description: TypeScript implementation and review tools.\n # plugins:\n # - development\n # # Mapping form can load only selected resources from a shared plugin.\n # - name: remote-review\n # skills: [typescript]\n # agents: [reviewer]\n # hooks: false\n # mcp: true\n # # Set false only when this domain should omit shared .claude/skills.\n # sharedSkills: false\n # # Domain mcp is an allowlist over servers configured elsewhere, not a\n # # request to start new ones. Listing servers here drops the tool schemas\n # # of the ones left out, usually the largest context saving a domain can\n # # make. Run po --explain to see the token cost before and after.\n # # Filtering applies only when every selected domain declares mcp, so a\n # # selection mixing this with a domain that omits it stays unfiltered.\n # mcp:\n # servers: [code-intel]\n # proxy: [repository-search]\n# Select it with po --domains development, or add it to defaultDomains.\n#\n# Aliases let one selection enable multiple domains. Replace the empty mapping\n# below with entries like the commented example.\naliases: {}\n# aliases:\n# work: [default, development]\n`,\n 'profiles.yaml': `# Profiles select a persona and optional environment defaults for a session.\n# Each configured root may itself be a profile or contain direct-child profile\n# folders. A folder is discovered when it contains profile.md, SOUL.md, or\n# AGENTS.md; discovery never scans recursively.\nprofiles:\n roots: []\n entries: {}\n # Roots resolve beside this file in ~/.po. Repository roots in a\n # repository .po/profiles.yaml resolve from that repository root.\n # roots: [agents/acme]\n # Explicit entries override an automatically discovered folder of the same\n # name. Environment values must be strings; already exported values win.\n # entries:\n # writer:\n # persona: agents/special/writer\n # env:\n # BRAND: acme\n # TONE: concise\n# Po Pi concatenates profile.md, SOUL.md, then AGENTS.md for the persona.\n# Select one with: po --profile writer\n`,\n};\n\n/** Standalone defaults for a repository that is trying Po through Po. */\nexport const REPOSITORY_PO_CONFIG_TEMPLATES: Readonly<Record<PoSeedFile, string>> = {\n 'config.yaml': PO_CONFIG_TEMPLATES['config.yaml'],\n 'modes.yaml': `# Repository-local layers and major modes. These entries override personal\n# entries with the same name from ~/.po/modes.yaml.\n# This repository-local default replaces the personal top-level default as one\n# whole package list. Edit it to customize the standalone package baseline.\ndefault:\n packages:\n - '@agimon-ai/po-help'\n - '@agimon-ai/po-hook'\n - '@agimon-ai/po-goal'\n - '@agimon-ai/po-voice'\n - '@agimon-ai/po-runner'\n - '@agimon-ai/po-read'\n - '@agimon-ai/po-grep'\n - '@agimon-ai/po-edit'\n - '@agimon-ai/po-file-edit'\n - '@agimon-ai/po-autocompact'\n - '@agimon-ai/po-loop'\n - '@agimon-ai/po-plan'\n - '@agimon-ai/po-author'\n - '@agimon-ai/po-computer-use'\n - '@agimon-ai/po-workflow'\n - '@agimon-ai/po-log'\n - '@agimon-ai/po-mcp'\n - '@agimon-ai/po-prompt'\n - '@agimon-ai/po-template-advanced'\n - '@agimon-ai/po-template-elegant'\nlayers:\n team:\n packages:\n - name: '@agimon-ai/po-team'\n ask-user:\n packages:\n - '@agimon-ai/po-user-feedback'\n task:\n packages:\n - '@agimon-ai/po-task'\n sandbox:\n packages:\n - '@agimon-ai/po-sandbox'\n design:\n packages:\n - '@agimon-ai/po-style-system'\n llm:\n packages:\n - '@agimon-ai/po-model-guidance'\n source-control:\n packages:\n - '@agimon-ai/po-git'\n image-gen:\n packages:\n - '@agimon-ai/po-image-gen'\n web-search:\n packages:\n - '@agimon-ai/po-web-search'\n browser:\n packages:\n - '@agimon-ai/po-browse'\ndefaultMajorMode: copilot\nmajorMode:\n minimal:\n description: Lean mode with Team delegation and persistent tasks.\n layers: [team, task, llm]\n copilot:\n description: General-purpose coding mode with delegation, persistent tasks, supervised commands, and structured user feedback.\n layers: [team, ask-user, task, sandbox, llm, source-control, design, image-gen, web-search, browser]\n examples:\n description: Layer-free base mode for the repository's plugin and workflow examples.\n layers: []\n`,\n 'domains.yaml': `# Repository-local plugin catalog and domain selection.\ndefaultDomains: [default]\nplugins:\n roots: []\n entries: {}\ndomains:\n default:\n description: Shared skills and repository MCP only.\n plugins: []\naliases: {}\n`,\n 'profiles.yaml': `# Repository-local persona roots and environment defaults.\nprofiles:\n roots: []\n entries: {}\n`,\n};\n\n/** Result of filling a Po seed directory. File arrays contain names in seed order. */\nexport interface GlobalPoInitResult {\n directory: string;\n created: string[];\n preserved: string[];\n /** Existing files overwritten from the template. Only ever non-empty under `force`. */\n replaced: string[];\n}\n\nexport interface GlobalPoInitOptions {\n /**\n * Overwrite existing seed files instead of preserving them.\n *\n * Off by default: init is safe to re-run, and hand-edited config is the\n * normal case rather than the exception.\n */\n force?: boolean;\n}\n\nexport type RepositoryPoInitOptions = GlobalPoInitOptions;\nexport type RepositoryPoInitResult = GlobalPoInitResult;\n","import { randomUUID } from 'node:crypto';\nimport fs from 'node:fs';\nimport path from 'node:path';\n\nimport { nodeHost } from '@agimon-ai/po-core/platform';\n\nimport { globalPoConfigDirectory } from '../config';\nimport {\n PO_CONFIG_TEMPLATES,\n PO_DIRECTORY,\n GLOBAL_PO_SEED_FILES,\n PRIVATE_DIRECTORY_MODE,\n PRIVATE_FILE_MODE,\n REPOSITORY_DIRECTORY_MODE,\n REPOSITORY_PO_CONFIG_TEMPLATES,\n REPOSITORY_FILE_MODE,\n type PoSeedFile,\n type GlobalPoInitOptions,\n type GlobalPoInitResult,\n type RepositoryPoInitOptions,\n type RepositoryPoInitResult,\n} from './templates';\n\nconst UTF8_ENCODING = 'utf8';\nconst FILE_ALREADY_EXISTS = 'EEXIST';\nconst FILE_NOT_FOUND = 'ENOENT';\n\nfunction errorCode(error: unknown): string | undefined {\n if (!(error instanceof Error)) return undefined;\n const code = (error as NodeJS.ErrnoException).code;\n return typeof code === 'string' ? code : undefined;\n}\n\nfunction ensureDirectory(directory: string, mode: number): void {\n let stats: fs.Stats;\n try {\n stats = fs.lstatSync(directory);\n } catch (error) {\n if (errorCode(error) !== FILE_NOT_FOUND) throw error;\n try {\n fs.mkdirSync(directory, { mode });\n stats = fs.lstatSync(directory);\n } catch (mkdirError) {\n if (errorCode(mkdirError) !== FILE_ALREADY_EXISTS) throw mkdirError;\n stats = fs.lstatSync(directory);\n }\n }\n\n if (stats.isSymbolicLink()) {\n throw new Error(`Refusing to initialize through symlinked directory: ${directory}`);\n }\n if (!stats.isDirectory()) {\n throw new Error(`Po config path is not a directory: ${directory}`);\n }\n}\n\nfunction ensurePoDirectory(directory: string, mode: number): void {\n ensureDirectory(path.dirname(directory), mode);\n ensureDirectory(directory, mode);\n}\n\nfunction classifyTarget(targetPath: string): 'missing' | 'file' {\n let stats: fs.Stats;\n try {\n stats = fs.lstatSync(targetPath);\n } catch (error) {\n if (errorCode(error) === FILE_NOT_FOUND) return 'missing';\n throw error;\n }\n\n if (stats.isFile()) return 'file';\n if (stats.isSymbolicLink()) {\n try {\n if (fs.statSync(targetPath).isFile()) return 'file';\n } catch (error) {\n throw new Error(`Po config seed symlink is not file-like: ${targetPath}`, { cause: error });\n }\n }\n throw new Error(`Po config seed path is not file-like: ${targetPath}`);\n}\n\nfunction cleanupTemporaryFile(temporaryPath: string): void {\n try {\n fs.unlinkSync(temporaryPath);\n } catch (error) {\n if (errorCode(error) !== FILE_NOT_FOUND) throw error;\n }\n}\n\nfunction publishExclusively(targetPath: string, content: string, mode: number): boolean {\n const temporaryPath = `${targetPath}.${nodeHost.processId()}.${randomUUID()}.tmp`;\n let fileDescriptor: number | undefined;\n try {\n fileDescriptor = fs.openSync(temporaryPath, 'wx', mode);\n fs.writeFileSync(fileDescriptor, content, UTF8_ENCODING);\n fs.fchmodSync(fileDescriptor, mode);\n fs.fsyncSync(fileDescriptor);\n const descriptorToClose = fileDescriptor;\n fileDescriptor = undefined;\n fs.closeSync(descriptorToClose);\n\n try {\n fs.linkSync(temporaryPath, targetPath);\n return true;\n } catch (error) {\n if (errorCode(error) === FILE_ALREADY_EXISTS && classifyTarget(targetPath) === 'file') return false;\n throw error;\n }\n } finally {\n if (fileDescriptor !== undefined) {\n const descriptorToClose = fileDescriptor;\n fileDescriptor = undefined;\n fs.closeSync(descriptorToClose);\n }\n cleanupTemporaryFile(temporaryPath);\n }\n}\n\n/**\n * Replaces a seed file with the template, atomically.\n *\n * The rename swaps the directory entry in one step, so a reader either sees the\n * whole old file or the whole new one. Renaming onto a symlinked seed replaces\n * the link rather than writing through it.\n */\nfunction publishForcefully(targetPath: string, content: string, mode: number): void {\n const temporaryPath = `${targetPath}.${nodeHost.processId()}.${randomUUID()}.tmp`;\n let fileDescriptor: number | undefined;\n try {\n fileDescriptor = fs.openSync(temporaryPath, 'wx', mode);\n fs.writeFileSync(fileDescriptor, content, UTF8_ENCODING);\n fs.fchmodSync(fileDescriptor, mode);\n fs.fsyncSync(fileDescriptor);\n const descriptorToClose = fileDescriptor;\n fileDescriptor = undefined;\n fs.closeSync(descriptorToClose);\n\n fs.renameSync(temporaryPath, targetPath);\n } finally {\n if (fileDescriptor !== undefined) {\n const descriptorToClose = fileDescriptor;\n fileDescriptor = undefined;\n fs.closeSync(descriptorToClose);\n }\n cleanupTemporaryFile(temporaryPath);\n }\n}\n\nfunction initializePoConfig(\n directory: string,\n templates: Readonly<Record<PoSeedFile, string>>,\n options: GlobalPoInitOptions,\n directoryMode: number,\n fileMode: number,\n): GlobalPoInitResult {\n ensurePoDirectory(directory, directoryMode);\n\n const created: string[] = [];\n const preserved: string[] = [];\n const replaced: string[] = [];\n for (const fileName of GLOBAL_PO_SEED_FILES) {\n const targetPath = path.join(directory, fileName);\n const existed = classifyTarget(targetPath) === 'file';\n\n if (options.force) {\n publishForcefully(targetPath, templates[fileName], fileMode);\n (existed ? replaced : created).push(fileName);\n continue;\n }\n if (existed) {\n preserved.push(fileName);\n continue;\n }\n if (publishExclusively(targetPath, templates[fileName], fileMode)) created.push(fileName);\n else preserved.push(fileName);\n }\n\n return { directory, created, preserved, replaced };\n}\n\n/**\n * Fills missing global seed files.\n *\n * Existing files are left alone so that re-running init never discards\n * hand-edited config; pass `force` to overwrite them from the template. A new\n * file is published with an exclusive hard link, so a concurrent writer in\n * another process never loses its file to this one.\n *\n * @deprecated Node-only sync shim; use initializeGlobalPoConfigAsync. Removed in M2.\n */\nexport function initializeGlobalPoConfig(\n homeDirectory = nodeHost.homeDirectory(),\n options: GlobalPoInitOptions = {},\n): GlobalPoInitResult {\n return initializePoConfig(\n globalPoConfigDirectory(homeDirectory),\n PO_CONFIG_TEMPLATES,\n options,\n PRIVATE_DIRECTORY_MODE,\n PRIVATE_FILE_MODE,\n );\n}\n\n/**\n * Seeds repository-local configuration without creating or changing Pi settings.\n *\n * @deprecated Node-only sync shim; use initializeRepositoryPoConfigAsync. Removed in M2.\n */\nexport function initializeRepositoryPoConfig(\n repositoryRoot = process.cwd(),\n options: RepositoryPoInitOptions = {},\n): RepositoryPoInitResult {\n return initializePoConfig(\n path.join(path.resolve(repositoryRoot), PO_DIRECTORY),\n REPOSITORY_PO_CONFIG_TEMPLATES,\n options,\n REPOSITORY_DIRECTORY_MODE,\n REPOSITORY_FILE_MODE,\n );\n}\n","import path from 'node:path';\n\nimport {\n createSerialRunner,\n getOrThrow,\n nodeHost,\n writeFileAtomic,\n type FileSystem,\n} from '@agimon-ai/po-core/platform';\n\nimport { globalPoConfigDirectory } from '../config';\nimport {\n PO_CONFIG_TEMPLATES,\n PO_DIRECTORY,\n GLOBAL_PO_SEED_FILES,\n PRIVATE_DIRECTORY_MODE,\n PRIVATE_FILE_MODE,\n REPOSITORY_DIRECTORY_MODE,\n REPOSITORY_PO_CONFIG_TEMPLATES,\n REPOSITORY_FILE_MODE,\n type PoSeedFile,\n type GlobalPoInitOptions,\n type GlobalPoInitResult,\n type RepositoryPoInitOptions,\n type RepositoryPoInitResult,\n} from './templates';\n\ntype IoContext = Parameters<FileSystem['readTextFile']>[1];\n\nexport {\n PO_CONFIG_TEMPLATES,\n GLOBAL_PO_SEED_FILES,\n REPOSITORY_PO_CONFIG_TEMPLATES,\n type GlobalPoInitOptions,\n type GlobalPoInitResult,\n type RepositoryPoInitOptions,\n type RepositoryPoInitResult,\n} from './templates';\nexport { initializeGlobalPoConfig, initializeRepositoryPoConfig } from './sync';\n\n/** Seed writes in this process are queued per file, so a check and its write are not interleaved. */\nconst seedWrites = createSerialRunner();\n\nasync function ensureDirectory(fs: FileSystem, directory: string, mode: number, context: IoContext): Promise<void> {\n let info = await fs.fileInfo(directory, context);\n if (!info.ok && info.error.code === 'not_found') {\n const created = await fs.createDir(directory, { recursive: false }, context);\n if (created.ok) await nodeHost.setMode(directory, mode);\n info = await fs.fileInfo(directory, context);\n }\n const kind = getOrThrow(info).kind;\n if (kind === 'symlink') throw new Error(`Refusing to initialize through symlinked directory: ${directory}`);\n if (kind !== 'directory') throw new Error(`Po config path is not a directory: ${directory}`);\n}\n\nasync function classifyTarget(fs: FileSystem, targetPath: string, context: IoContext): Promise<'missing' | 'file'> {\n const info = await fs.fileInfo(targetPath, context);\n if (!info.ok && info.error.code === 'not_found') return 'missing';\n const kind = getOrThrow(info).kind;\n if (kind === 'file') return 'file';\n if (kind === 'symlink') {\n try {\n const target = getOrThrow(await fs.canonicalPath(targetPath, context));\n if (getOrThrow(await fs.fileInfo(target, context)).kind === 'file') return 'file';\n } catch (error) {\n throw new Error(`Po config seed symlink is not file-like: ${targetPath}`, { cause: error });\n }\n }\n throw new Error(`Po config seed path is not file-like: ${targetPath}`);\n}\n\nasync function publish(fs: FileSystem, targetPath: string, content: string, mode: number, context: IoContext) {\n await writeFileAtomic(fs, targetPath, content, context);\n await nodeHost.setMode(targetPath, mode);\n}\n\n/**\n * Fills one seed directory over a FileSystem.\n *\n * Without `force`, a missing file is checked and written inside one queued step\n * per file. The FileSystem has no exclusive create, so a second process writing\n * the same new file at the same instant can be overwritten; the Node-only sync\n * shim keeps its hard-link publication for that case.\n */\nasync function initializePoConfig(\n fs: FileSystem,\n directory: string,\n templates: Readonly<Record<PoSeedFile, string>>,\n options: GlobalPoInitOptions,\n directoryMode: number,\n fileMode: number,\n context: IoContext,\n): Promise<GlobalPoInitResult> {\n await ensureDirectory(fs, path.dirname(directory), directoryMode, context);\n await ensureDirectory(fs, directory, directoryMode, context);\n\n const created: string[] = [];\n const preserved: string[] = [];\n const replaced: string[] = [];\n for (const fileName of GLOBAL_PO_SEED_FILES) {\n const targetPath = path.join(directory, fileName);\n await seedWrites.forKey(path.resolve(targetPath))(async () => {\n const existed = (await classifyTarget(fs, targetPath, context)) === 'file';\n if (existed && !options.force) {\n preserved.push(fileName);\n return;\n }\n await publish(fs, targetPath, templates[fileName], fileMode, context);\n (existed ? replaced : created).push(fileName);\n });\n }\n return { directory, created, preserved, replaced };\n}\n\n/**\n * Fills missing global seed files over a FileSystem.\n *\n * Existing files are left alone so that re-running init never discards\n * hand-edited config; pass `force` to overwrite them from the template.\n */\nexport function initializeGlobalPoConfigAsync(\n fs: FileSystem,\n context: IoContext,\n homeDirectory = nodeHost.homeDirectory(),\n options: GlobalPoInitOptions = {},\n): Promise<GlobalPoInitResult> {\n return initializePoConfig(\n fs,\n globalPoConfigDirectory(homeDirectory),\n PO_CONFIG_TEMPLATES,\n options,\n PRIVATE_DIRECTORY_MODE,\n PRIVATE_FILE_MODE,\n context,\n );\n}\n\n/** Seeds repository-local configuration over a FileSystem without creating or changing Pi settings. */\nexport function initializeRepositoryPoConfigAsync(\n fs: FileSystem,\n repositoryRoot: string,\n context: IoContext,\n options: RepositoryPoInitOptions = {},\n): Promise<RepositoryPoInitResult> {\n return initializePoConfig(\n fs,\n path.join(path.resolve(repositoryRoot), PO_DIRECTORY),\n REPOSITORY_PO_CONFIG_TEMPLATES,\n options,\n REPOSITORY_DIRECTORY_MODE,\n REPOSITORY_FILE_MODE,\n context,\n );\n}\n"],"mappings":";;;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AAW,CAAC,QAAQ,OAAO;IAC7B,UAAU,KAAK,QAAQ;IACvB;GACF;GACA,MAAM,QAAQ,IAAI,YAAY,UAAU,WAAW,UAAU,OAAO;GACpE,CAAC,UAAU,WAAW,QAAA,CAAS,KAAK,QAAQ;EAC9C,CAAC;CACH;CACA,OAAO;EAAE;EAAW;EAAS;EAAW;CAAS;AACnD;;;;;;;AAQA,SAAgB,8BACd,IACA,SACA,gBAAgBH,4BAAAA,SAAS,cAAc,GACvC,UAA+B,CAAC,GACH;CAC7B,OAAO,mBACL,IACAI,aAAAA,wBAAwB,aAAa,GACrC,qBACA,SAAA,KAAA,KAGA,OACF;AACF;;AAGA,SAAgB,kCACd,IACA,gBACA,SACA,UAAmC,CAAC,GACH;CACjC,OAAO,mBACL,IACAD,UAAAA,QAAK,KAAKA,UAAAA,QAAK,QAAQ,cAAc,GAAA,KAAe,GACpD,gCACA,SAAA,KAAA,KAGA,OACF;AACF"}
|
|
@@ -81,13 +81,14 @@ default:
|
|
|
81
81
|
- '@agimon-ai/po-autocompact'
|
|
82
82
|
- '@agimon-ai/po-loop'
|
|
83
83
|
- '@agimon-ai/po-plan'
|
|
84
|
+
- '@agimon-ai/po-author'
|
|
85
|
+
- '@agimon-ai/po-computer-use'
|
|
84
86
|
- '@agimon-ai/po-workflow'
|
|
85
87
|
- '@agimon-ai/po-log'
|
|
86
88
|
- '@agimon-ai/po-mcp'
|
|
87
|
-
- '@agimon-ai/po-template-elegant'
|
|
88
89
|
- '@agimon-ai/po-prompt'
|
|
89
|
-
- '@agimon-ai/po-
|
|
90
|
-
- '@agimon-ai/po-
|
|
90
|
+
- '@agimon-ai/po-template-advanced'
|
|
91
|
+
- '@agimon-ai/po-template-elegant'
|
|
91
92
|
layers:
|
|
92
93
|
team:
|
|
93
94
|
packages:
|
|
@@ -106,30 +107,27 @@ layers:
|
|
|
106
107
|
task:
|
|
107
108
|
packages:
|
|
108
109
|
- '@agimon-ai/po-task'
|
|
109
|
-
|
|
110
|
+
sandbox:
|
|
110
111
|
packages:
|
|
111
|
-
- '@agimon-ai/po-
|
|
112
|
+
- '@agimon-ai/po-sandbox'
|
|
112
113
|
design:
|
|
113
114
|
packages:
|
|
114
115
|
- '@agimon-ai/po-style-system'
|
|
115
|
-
image-gen:
|
|
116
|
-
packages:
|
|
117
|
-
- '@agimon-ai/po-image-gen'
|
|
118
116
|
llm:
|
|
119
117
|
packages:
|
|
120
118
|
- '@agimon-ai/po-model-guidance'
|
|
121
|
-
sandbox:
|
|
122
|
-
packages:
|
|
123
|
-
- '@agimon-ai/po-sandbox'
|
|
124
119
|
source-control:
|
|
125
120
|
packages:
|
|
126
121
|
- '@agimon-ai/po-git'
|
|
127
|
-
|
|
122
|
+
image-gen:
|
|
128
123
|
packages:
|
|
129
|
-
- '@agimon-ai/po-
|
|
124
|
+
- '@agimon-ai/po-image-gen'
|
|
130
125
|
web-search:
|
|
131
126
|
packages:
|
|
132
127
|
- '@agimon-ai/po-web-search'
|
|
128
|
+
browser:
|
|
129
|
+
packages:
|
|
130
|
+
- '@agimon-ai/po-browse'
|
|
133
131
|
# A major mode explains when it should be used and names its ordered layers.
|
|
134
132
|
# Add another entry under majorMode, then select it with
|
|
135
133
|
# po --major-mode <name>. Change defaultMajorMode to make it the default.
|
|
@@ -137,10 +135,13 @@ defaultMajorMode: copilot
|
|
|
137
135
|
majorMode:
|
|
138
136
|
minimal:
|
|
139
137
|
description: Lean mode with Team delegation and persistent tasks.
|
|
140
|
-
layers: [team, task]
|
|
138
|
+
layers: [team, task, llm]
|
|
141
139
|
copilot:
|
|
142
|
-
description: General-purpose coding mode with
|
|
143
|
-
layers: [team, ask-user, task,
|
|
140
|
+
description: General-purpose coding mode with delegation, persistent tasks, supervised commands, and structured user feedback.
|
|
141
|
+
layers: [team, ask-user, task, sandbox, llm, source-control, design, image-gen, web-search, browser]
|
|
142
|
+
examples:
|
|
143
|
+
description: Layer-free base mode for the repository's plugin and workflow examples.
|
|
144
|
+
layers: []
|
|
144
145
|
# review:
|
|
145
146
|
# description: Focused review mode for inspecting changes and reporting risks.
|
|
146
147
|
# layers: [team, task, ask-user]
|
|
@@ -245,13 +246,14 @@ default:
|
|
|
245
246
|
- '@agimon-ai/po-autocompact'
|
|
246
247
|
- '@agimon-ai/po-loop'
|
|
247
248
|
- '@agimon-ai/po-plan'
|
|
249
|
+
- '@agimon-ai/po-author'
|
|
250
|
+
- '@agimon-ai/po-computer-use'
|
|
248
251
|
- '@agimon-ai/po-workflow'
|
|
249
252
|
- '@agimon-ai/po-log'
|
|
250
253
|
- '@agimon-ai/po-mcp'
|
|
251
|
-
- '@agimon-ai/po-template-elegant'
|
|
252
254
|
- '@agimon-ai/po-prompt'
|
|
253
|
-
- '@agimon-ai/po-
|
|
254
|
-
- '@agimon-ai/po-
|
|
255
|
+
- '@agimon-ai/po-template-advanced'
|
|
256
|
+
- '@agimon-ai/po-template-elegant'
|
|
255
257
|
layers:
|
|
256
258
|
team:
|
|
257
259
|
packages:
|
|
@@ -262,38 +264,38 @@ layers:
|
|
|
262
264
|
task:
|
|
263
265
|
packages:
|
|
264
266
|
- '@agimon-ai/po-task'
|
|
265
|
-
|
|
267
|
+
sandbox:
|
|
266
268
|
packages:
|
|
267
|
-
- '@agimon-ai/po-
|
|
269
|
+
- '@agimon-ai/po-sandbox'
|
|
268
270
|
design:
|
|
269
271
|
packages:
|
|
270
272
|
- '@agimon-ai/po-style-system'
|
|
271
|
-
image-gen:
|
|
272
|
-
packages:
|
|
273
|
-
- '@agimon-ai/po-image-gen'
|
|
274
273
|
llm:
|
|
275
274
|
packages:
|
|
276
275
|
- '@agimon-ai/po-model-guidance'
|
|
277
|
-
sandbox:
|
|
278
|
-
packages:
|
|
279
|
-
- '@agimon-ai/po-sandbox'
|
|
280
276
|
source-control:
|
|
281
277
|
packages:
|
|
282
278
|
- '@agimon-ai/po-git'
|
|
283
|
-
|
|
279
|
+
image-gen:
|
|
284
280
|
packages:
|
|
285
|
-
- '@agimon-ai/po-
|
|
281
|
+
- '@agimon-ai/po-image-gen'
|
|
286
282
|
web-search:
|
|
287
283
|
packages:
|
|
288
284
|
- '@agimon-ai/po-web-search'
|
|
285
|
+
browser:
|
|
286
|
+
packages:
|
|
287
|
+
- '@agimon-ai/po-browse'
|
|
289
288
|
defaultMajorMode: copilot
|
|
290
289
|
majorMode:
|
|
291
290
|
minimal:
|
|
292
291
|
description: Lean mode with Team delegation and persistent tasks.
|
|
293
|
-
layers: [team, task]
|
|
292
|
+
layers: [team, task, llm]
|
|
294
293
|
copilot:
|
|
295
294
|
description: General-purpose coding mode with delegation, persistent tasks, supervised commands, and structured user feedback.
|
|
296
|
-
layers: [team, ask-user, task,
|
|
295
|
+
layers: [team, ask-user, task, sandbox, llm, source-control, design, image-gen, web-search, browser]
|
|
296
|
+
examples:
|
|
297
|
+
description: Layer-free base mode for the repository's plugin and workflow examples.
|
|
298
|
+
layers: []
|
|
297
299
|
`,
|
|
298
300
|
"domains.yaml": `# Repository-local plugin catalog and domain selection.
|
|
299
301
|
defaultDomains: [default]
|
|
@@ -549,4 +551,4 @@ function initializeRepositoryPoConfigAsync(fs, repositoryRoot, context, options
|
|
|
549
551
|
//#endregion
|
|
550
552
|
export { GLOBAL_PO_SEED_FILES as a, initializeRepositoryPoConfig as i, initializeRepositoryPoConfigAsync as n, PO_CONFIG_TEMPLATES as o, initializeGlobalPoConfig as r, REPOSITORY_PO_CONFIG_TEMPLATES as s, initializeGlobalPoConfigAsync as t };
|
|
551
553
|
|
|
552
|
-
//# sourceMappingURL=init-
|
|
554
|
+
//# sourceMappingURL=init-DG7MxGxC.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"init-DG7MxGxC.mjs","names":["ensureDirectory","classifyTarget","initializePoConfig"],"sources":["../src/services/init/templates.ts","../src/services/init/sync.ts","../src/services/init/index.ts"],"sourcesContent":["export const PRIVATE_DIRECTORY_MODE = 0o700;\nexport const PRIVATE_FILE_MODE = 0o600;\nexport const REPOSITORY_DIRECTORY_MODE = 0o755;\nexport const REPOSITORY_FILE_MODE = 0o644;\nexport const PO_DIRECTORY = '.po';\n\n/** The global seed files are processed in this fixed order. */\nexport const GLOBAL_PO_SEED_FILES = ['config.yaml', 'modes.yaml', 'domains.yaml', 'profiles.yaml'] as const;\n\nexport type PoSeedFile = (typeof GLOBAL_PO_SEED_FILES)[number];\n\n/** Portable defaults for a new global Po configuration directory. */\nexport const PO_CONFIG_TEMPLATES: Readonly<Record<PoSeedFile, string>> = {\n 'config.yaml': `projectTrust: ask\n\n# Autonomous voice is opt-in and uses an explicitly configured Pi model.\n# voice:\n# autoCapture:\n# model: provider/model-id\n# startPhrases:\n# - hey po\n# stopPhrases:\n# - stop speaking\n# utteranceIdleMs: 3000\n# # Long prompts only: open a draft, keep talking, then send it in one piece.\n# # Short utterances are delivered as you finish them and need no phrase.\n# composeOpenPhrases:\n# - hey po\n# composeSendPhrases:\n# - that's it\n# composeCancelPhrases:\n# - scratch that\n# # Endpoint window while a draft collects, so a short command lands on its own.\n# composeUtteranceIdleMs: 1200\n# # Silence before Voice reminds you a draft is open. 0 turns the reminder off.\n# composeNudgeMs: 10000\n# tts:\n# engine: macos-say\n# voice: Samantha\n# rate: 190\n`,\n 'modes.yaml': `# A layer is a reusable named bundle of packages, built-in or local extensions,\n# and hook groups. Major modes below choose which layers load together for a session.\n#\n# Layers and modes defined here apply to every repository. A repository's own\n# .po/modes.yaml is read after this file and replaces any layer or mode of the\n# same name, so a repository can override one entry without restating the rest.\n#\n# Add a layer by giving it a unique name under layers. Local Pi scripts belong\n# under extensions, while installed Pi packages belong under packages:\n# review-tools:\n# extensions:\n# - './extensions/local-review.ts'\n# packages:\n# - '@scope/review-extension'\n# A bare extension name selects a Po built-in. A path beginning with ./ or\n# ../ loads a custom script or extension directory. A bare package loads its\n# ordered package.json pi.extensions entries, while an exported subpath selects\n# one adapter. Relative paths resolve beside this file here (~/.po), or\n# from the repository root in .po/modes.yaml.\n#\n# Use a package mapping when that package accepts configuration. Configuration\n# belongs under the package entry that consumes it, not beside packages.\n# The top-level default bundle loads before every major mode. Replace this whole\n# packages list to customize the distribution defaults. Po core packages\n# remain active independently of this list.\ndefault:\n packages:\n - '@agimon-ai/po-help'\n - '@agimon-ai/po-hook'\n - '@agimon-ai/po-goal'\n - '@agimon-ai/po-voice'\n - '@agimon-ai/po-runner'\n - '@agimon-ai/po-read'\n - '@agimon-ai/po-grep'\n - '@agimon-ai/po-edit'\n - '@agimon-ai/po-file-edit'\n - '@agimon-ai/po-autocompact'\n - '@agimon-ai/po-loop'\n - '@agimon-ai/po-plan'\n - '@agimon-ai/po-author'\n - '@agimon-ai/po-computer-use'\n - '@agimon-ai/po-workflow'\n - '@agimon-ai/po-log'\n - '@agimon-ai/po-mcp'\n - '@agimon-ai/po-prompt'\n - '@agimon-ai/po-template-advanced'\n - '@agimon-ai/po-template-elegant'\nlayers:\n team:\n packages:\n - name: '@agimon-ai/po-team'\n # Optional Team configuration. Uncomment and choose models available to Pi.\n # config:\n # models:\n # - model: openai-codex/gpt-5.6-luna\n # thinking: xhigh\n # # Tool names excluded from subagents launched by this package. These\n # # remove model-visible tools while preserving hidden team transport.\n # excludeTools: [ask_user_question, intercom, subagent]\n ask-user:\n packages:\n - '@agimon-ai/po-user-feedback'\n task:\n packages:\n - '@agimon-ai/po-task'\n sandbox:\n packages:\n - '@agimon-ai/po-sandbox'\n design:\n packages:\n - '@agimon-ai/po-style-system'\n llm:\n packages:\n - '@agimon-ai/po-model-guidance'\n source-control:\n packages:\n - '@agimon-ai/po-git'\n image-gen:\n packages:\n - '@agimon-ai/po-image-gen'\n web-search:\n packages:\n - '@agimon-ai/po-web-search'\n browser:\n packages:\n - '@agimon-ai/po-browse'\n# A major mode explains when it should be used and names its ordered layers.\n# Add another entry under majorMode, then select it with\n# po --major-mode <name>. Change defaultMajorMode to make it the default.\ndefaultMajorMode: copilot\nmajorMode:\n minimal:\n description: Lean mode with Team delegation and persistent tasks.\n layers: [team, task, llm]\n copilot:\n description: General-purpose coding mode with delegation, persistent tasks, supervised commands, and structured user feedback.\n layers: [team, ask-user, task, sandbox, llm, source-control, design, image-gen, web-search, browser]\n examples:\n description: Layer-free base mode for the repository's plugin and workflow examples.\n layers: []\n # review:\n # description: Focused review mode for inspecting changes and reporting risks.\n # layers: [team, task, ask-user]\n`,\n 'domains.yaml': `# Plugins are named once in this catalog, then selected by one or more domains.\n# Po automatically inspects personal and repository Codex marketplaces.\n# Each configured root may also be a folder whose direct children are plugins;\n# use roots: [plugins] to discover a repository plugin folder without one entry\n# per plugin. Discovery never scans recursively.\ndefaultDomains: [default]\nplugins:\n roots: []\n entries: {}\n # Local paths resolve beside this file in ~/.po. Repository paths in a\n # repository .po/domains.yaml resolve from that repository root.\n # entries:\n # development:\n # source: local\n # path: plugins/development\n # remote-review:\n # source: url\n # url: https://github.com/acme/review-plugin.git\n # ref: v1.2.0\n # published-review:\n # source: npm\n # package: '@acme/review-plugin'\n # version: 1.2.0\n# Domains carry descriptions and refer to catalog names, not filesystem paths.\ndomains:\n default:\n description: Shared skills and repository MCP only.\n plugins: []\n # development:\n # description: TypeScript implementation and review tools.\n # plugins:\n # - development\n # # Mapping form can load only selected resources from a shared plugin.\n # - name: remote-review\n # skills: [typescript]\n # agents: [reviewer]\n # hooks: false\n # mcp: true\n # # Set false only when this domain should omit shared .claude/skills.\n # sharedSkills: false\n # # Domain mcp is an allowlist over servers configured elsewhere, not a\n # # request to start new ones. Listing servers here drops the tool schemas\n # # of the ones left out, usually the largest context saving a domain can\n # # make. Run po --explain to see the token cost before and after.\n # # Filtering applies only when every selected domain declares mcp, so a\n # # selection mixing this with a domain that omits it stays unfiltered.\n # mcp:\n # servers: [code-intel]\n # proxy: [repository-search]\n# Select it with po --domains development, or add it to defaultDomains.\n#\n# Aliases let one selection enable multiple domains. Replace the empty mapping\n# below with entries like the commented example.\naliases: {}\n# aliases:\n# work: [default, development]\n`,\n 'profiles.yaml': `# Profiles select a persona and optional environment defaults for a session.\n# Each configured root may itself be a profile or contain direct-child profile\n# folders. A folder is discovered when it contains profile.md, SOUL.md, or\n# AGENTS.md; discovery never scans recursively.\nprofiles:\n roots: []\n entries: {}\n # Roots resolve beside this file in ~/.po. Repository roots in a\n # repository .po/profiles.yaml resolve from that repository root.\n # roots: [agents/acme]\n # Explicit entries override an automatically discovered folder of the same\n # name. Environment values must be strings; already exported values win.\n # entries:\n # writer:\n # persona: agents/special/writer\n # env:\n # BRAND: acme\n # TONE: concise\n# Po Pi concatenates profile.md, SOUL.md, then AGENTS.md for the persona.\n# Select one with: po --profile writer\n`,\n};\n\n/** Standalone defaults for a repository that is trying Po through Po. */\nexport const REPOSITORY_PO_CONFIG_TEMPLATES: Readonly<Record<PoSeedFile, string>> = {\n 'config.yaml': PO_CONFIG_TEMPLATES['config.yaml'],\n 'modes.yaml': `# Repository-local layers and major modes. These entries override personal\n# entries with the same name from ~/.po/modes.yaml.\n# This repository-local default replaces the personal top-level default as one\n# whole package list. Edit it to customize the standalone package baseline.\ndefault:\n packages:\n - '@agimon-ai/po-help'\n - '@agimon-ai/po-hook'\n - '@agimon-ai/po-goal'\n - '@agimon-ai/po-voice'\n - '@agimon-ai/po-runner'\n - '@agimon-ai/po-read'\n - '@agimon-ai/po-grep'\n - '@agimon-ai/po-edit'\n - '@agimon-ai/po-file-edit'\n - '@agimon-ai/po-autocompact'\n - '@agimon-ai/po-loop'\n - '@agimon-ai/po-plan'\n - '@agimon-ai/po-author'\n - '@agimon-ai/po-computer-use'\n - '@agimon-ai/po-workflow'\n - '@agimon-ai/po-log'\n - '@agimon-ai/po-mcp'\n - '@agimon-ai/po-prompt'\n - '@agimon-ai/po-template-advanced'\n - '@agimon-ai/po-template-elegant'\nlayers:\n team:\n packages:\n - name: '@agimon-ai/po-team'\n ask-user:\n packages:\n - '@agimon-ai/po-user-feedback'\n task:\n packages:\n - '@agimon-ai/po-task'\n sandbox:\n packages:\n - '@agimon-ai/po-sandbox'\n design:\n packages:\n - '@agimon-ai/po-style-system'\n llm:\n packages:\n - '@agimon-ai/po-model-guidance'\n source-control:\n packages:\n - '@agimon-ai/po-git'\n image-gen:\n packages:\n - '@agimon-ai/po-image-gen'\n web-search:\n packages:\n - '@agimon-ai/po-web-search'\n browser:\n packages:\n - '@agimon-ai/po-browse'\ndefaultMajorMode: copilot\nmajorMode:\n minimal:\n description: Lean mode with Team delegation and persistent tasks.\n layers: [team, task, llm]\n copilot:\n description: General-purpose coding mode with delegation, persistent tasks, supervised commands, and structured user feedback.\n layers: [team, ask-user, task, sandbox, llm, source-control, design, image-gen, web-search, browser]\n examples:\n description: Layer-free base mode for the repository's plugin and workflow examples.\n layers: []\n`,\n 'domains.yaml': `# Repository-local plugin catalog and domain selection.\ndefaultDomains: [default]\nplugins:\n roots: []\n entries: {}\ndomains:\n default:\n description: Shared skills and repository MCP only.\n plugins: []\naliases: {}\n`,\n 'profiles.yaml': `# Repository-local persona roots and environment defaults.\nprofiles:\n roots: []\n entries: {}\n`,\n};\n\n/** Result of filling a Po seed directory. File arrays contain names in seed order. */\nexport interface GlobalPoInitResult {\n directory: string;\n created: string[];\n preserved: string[];\n /** Existing files overwritten from the template. Only ever non-empty under `force`. */\n replaced: string[];\n}\n\nexport interface GlobalPoInitOptions {\n /**\n * Overwrite existing seed files instead of preserving them.\n *\n * Off by default: init is safe to re-run, and hand-edited config is the\n * normal case rather than the exception.\n */\n force?: boolean;\n}\n\nexport type RepositoryPoInitOptions = GlobalPoInitOptions;\nexport type RepositoryPoInitResult = GlobalPoInitResult;\n","import { randomUUID } from 'node:crypto';\nimport fs from 'node:fs';\nimport path from 'node:path';\n\nimport { nodeHost } from '@agimon-ai/po-core/platform';\n\nimport { globalPoConfigDirectory } from '../config';\nimport {\n PO_CONFIG_TEMPLATES,\n PO_DIRECTORY,\n GLOBAL_PO_SEED_FILES,\n PRIVATE_DIRECTORY_MODE,\n PRIVATE_FILE_MODE,\n REPOSITORY_DIRECTORY_MODE,\n REPOSITORY_PO_CONFIG_TEMPLATES,\n REPOSITORY_FILE_MODE,\n type PoSeedFile,\n type GlobalPoInitOptions,\n type GlobalPoInitResult,\n type RepositoryPoInitOptions,\n type RepositoryPoInitResult,\n} from './templates';\n\nconst UTF8_ENCODING = 'utf8';\nconst FILE_ALREADY_EXISTS = 'EEXIST';\nconst FILE_NOT_FOUND = 'ENOENT';\n\nfunction errorCode(error: unknown): string | undefined {\n if (!(error instanceof Error)) return undefined;\n const code = (error as NodeJS.ErrnoException).code;\n return typeof code === 'string' ? code : undefined;\n}\n\nfunction ensureDirectory(directory: string, mode: number): void {\n let stats: fs.Stats;\n try {\n stats = fs.lstatSync(directory);\n } catch (error) {\n if (errorCode(error) !== FILE_NOT_FOUND) throw error;\n try {\n fs.mkdirSync(directory, { mode });\n stats = fs.lstatSync(directory);\n } catch (mkdirError) {\n if (errorCode(mkdirError) !== FILE_ALREADY_EXISTS) throw mkdirError;\n stats = fs.lstatSync(directory);\n }\n }\n\n if (stats.isSymbolicLink()) {\n throw new Error(`Refusing to initialize through symlinked directory: ${directory}`);\n }\n if (!stats.isDirectory()) {\n throw new Error(`Po config path is not a directory: ${directory}`);\n }\n}\n\nfunction ensurePoDirectory(directory: string, mode: number): void {\n ensureDirectory(path.dirname(directory), mode);\n ensureDirectory(directory, mode);\n}\n\nfunction classifyTarget(targetPath: string): 'missing' | 'file' {\n let stats: fs.Stats;\n try {\n stats = fs.lstatSync(targetPath);\n } catch (error) {\n if (errorCode(error) === FILE_NOT_FOUND) return 'missing';\n throw error;\n }\n\n if (stats.isFile()) return 'file';\n if (stats.isSymbolicLink()) {\n try {\n if (fs.statSync(targetPath).isFile()) return 'file';\n } catch (error) {\n throw new Error(`Po config seed symlink is not file-like: ${targetPath}`, { cause: error });\n }\n }\n throw new Error(`Po config seed path is not file-like: ${targetPath}`);\n}\n\nfunction cleanupTemporaryFile(temporaryPath: string): void {\n try {\n fs.unlinkSync(temporaryPath);\n } catch (error) {\n if (errorCode(error) !== FILE_NOT_FOUND) throw error;\n }\n}\n\nfunction publishExclusively(targetPath: string, content: string, mode: number): boolean {\n const temporaryPath = `${targetPath}.${nodeHost.processId()}.${randomUUID()}.tmp`;\n let fileDescriptor: number | undefined;\n try {\n fileDescriptor = fs.openSync(temporaryPath, 'wx', mode);\n fs.writeFileSync(fileDescriptor, content, UTF8_ENCODING);\n fs.fchmodSync(fileDescriptor, mode);\n fs.fsyncSync(fileDescriptor);\n const descriptorToClose = fileDescriptor;\n fileDescriptor = undefined;\n fs.closeSync(descriptorToClose);\n\n try {\n fs.linkSync(temporaryPath, targetPath);\n return true;\n } catch (error) {\n if (errorCode(error) === FILE_ALREADY_EXISTS && classifyTarget(targetPath) === 'file') return false;\n throw error;\n }\n } finally {\n if (fileDescriptor !== undefined) {\n const descriptorToClose = fileDescriptor;\n fileDescriptor = undefined;\n fs.closeSync(descriptorToClose);\n }\n cleanupTemporaryFile(temporaryPath);\n }\n}\n\n/**\n * Replaces a seed file with the template, atomically.\n *\n * The rename swaps the directory entry in one step, so a reader either sees the\n * whole old file or the whole new one. Renaming onto a symlinked seed replaces\n * the link rather than writing through it.\n */\nfunction publishForcefully(targetPath: string, content: string, mode: number): void {\n const temporaryPath = `${targetPath}.${nodeHost.processId()}.${randomUUID()}.tmp`;\n let fileDescriptor: number | undefined;\n try {\n fileDescriptor = fs.openSync(temporaryPath, 'wx', mode);\n fs.writeFileSync(fileDescriptor, content, UTF8_ENCODING);\n fs.fchmodSync(fileDescriptor, mode);\n fs.fsyncSync(fileDescriptor);\n const descriptorToClose = fileDescriptor;\n fileDescriptor = undefined;\n fs.closeSync(descriptorToClose);\n\n fs.renameSync(temporaryPath, targetPath);\n } finally {\n if (fileDescriptor !== undefined) {\n const descriptorToClose = fileDescriptor;\n fileDescriptor = undefined;\n fs.closeSync(descriptorToClose);\n }\n cleanupTemporaryFile(temporaryPath);\n }\n}\n\nfunction initializePoConfig(\n directory: string,\n templates: Readonly<Record<PoSeedFile, string>>,\n options: GlobalPoInitOptions,\n directoryMode: number,\n fileMode: number,\n): GlobalPoInitResult {\n ensurePoDirectory(directory, directoryMode);\n\n const created: string[] = [];\n const preserved: string[] = [];\n const replaced: string[] = [];\n for (const fileName of GLOBAL_PO_SEED_FILES) {\n const targetPath = path.join(directory, fileName);\n const existed = classifyTarget(targetPath) === 'file';\n\n if (options.force) {\n publishForcefully(targetPath, templates[fileName], fileMode);\n (existed ? replaced : created).push(fileName);\n continue;\n }\n if (existed) {\n preserved.push(fileName);\n continue;\n }\n if (publishExclusively(targetPath, templates[fileName], fileMode)) created.push(fileName);\n else preserved.push(fileName);\n }\n\n return { directory, created, preserved, replaced };\n}\n\n/**\n * Fills missing global seed files.\n *\n * Existing files are left alone so that re-running init never discards\n * hand-edited config; pass `force` to overwrite them from the template. A new\n * file is published with an exclusive hard link, so a concurrent writer in\n * another process never loses its file to this one.\n *\n * @deprecated Node-only sync shim; use initializeGlobalPoConfigAsync. Removed in M2.\n */\nexport function initializeGlobalPoConfig(\n homeDirectory = nodeHost.homeDirectory(),\n options: GlobalPoInitOptions = {},\n): GlobalPoInitResult {\n return initializePoConfig(\n globalPoConfigDirectory(homeDirectory),\n PO_CONFIG_TEMPLATES,\n options,\n PRIVATE_DIRECTORY_MODE,\n PRIVATE_FILE_MODE,\n );\n}\n\n/**\n * Seeds repository-local configuration without creating or changing Pi settings.\n *\n * @deprecated Node-only sync shim; use initializeRepositoryPoConfigAsync. Removed in M2.\n */\nexport function initializeRepositoryPoConfig(\n repositoryRoot = process.cwd(),\n options: RepositoryPoInitOptions = {},\n): RepositoryPoInitResult {\n return initializePoConfig(\n path.join(path.resolve(repositoryRoot), PO_DIRECTORY),\n REPOSITORY_PO_CONFIG_TEMPLATES,\n options,\n REPOSITORY_DIRECTORY_MODE,\n REPOSITORY_FILE_MODE,\n );\n}\n","import path from 'node:path';\n\nimport {\n createSerialRunner,\n getOrThrow,\n nodeHost,\n writeFileAtomic,\n type FileSystem,\n} from '@agimon-ai/po-core/platform';\n\nimport { globalPoConfigDirectory } from '../config';\nimport {\n PO_CONFIG_TEMPLATES,\n PO_DIRECTORY,\n GLOBAL_PO_SEED_FILES,\n PRIVATE_DIRECTORY_MODE,\n PRIVATE_FILE_MODE,\n REPOSITORY_DIRECTORY_MODE,\n REPOSITORY_PO_CONFIG_TEMPLATES,\n REPOSITORY_FILE_MODE,\n type PoSeedFile,\n type GlobalPoInitOptions,\n type GlobalPoInitResult,\n type RepositoryPoInitOptions,\n type RepositoryPoInitResult,\n} from './templates';\n\ntype IoContext = Parameters<FileSystem['readTextFile']>[1];\n\nexport {\n PO_CONFIG_TEMPLATES,\n GLOBAL_PO_SEED_FILES,\n REPOSITORY_PO_CONFIG_TEMPLATES,\n type GlobalPoInitOptions,\n type GlobalPoInitResult,\n type RepositoryPoInitOptions,\n type RepositoryPoInitResult,\n} from './templates';\nexport { initializeGlobalPoConfig, initializeRepositoryPoConfig } from './sync';\n\n/** Seed writes in this process are queued per file, so a check and its write are not interleaved. */\nconst seedWrites = createSerialRunner();\n\nasync function ensureDirectory(fs: FileSystem, directory: string, mode: number, context: IoContext): Promise<void> {\n let info = await fs.fileInfo(directory, context);\n if (!info.ok && info.error.code === 'not_found') {\n const created = await fs.createDir(directory, { recursive: false }, context);\n if (created.ok) await nodeHost.setMode(directory, mode);\n info = await fs.fileInfo(directory, context);\n }\n const kind = getOrThrow(info).kind;\n if (kind === 'symlink') throw new Error(`Refusing to initialize through symlinked directory: ${directory}`);\n if (kind !== 'directory') throw new Error(`Po config path is not a directory: ${directory}`);\n}\n\nasync function classifyTarget(fs: FileSystem, targetPath: string, context: IoContext): Promise<'missing' | 'file'> {\n const info = await fs.fileInfo(targetPath, context);\n if (!info.ok && info.error.code === 'not_found') return 'missing';\n const kind = getOrThrow(info).kind;\n if (kind === 'file') return 'file';\n if (kind === 'symlink') {\n try {\n const target = getOrThrow(await fs.canonicalPath(targetPath, context));\n if (getOrThrow(await fs.fileInfo(target, context)).kind === 'file') return 'file';\n } catch (error) {\n throw new Error(`Po config seed symlink is not file-like: ${targetPath}`, { cause: error });\n }\n }\n throw new Error(`Po config seed path is not file-like: ${targetPath}`);\n}\n\nasync function publish(fs: FileSystem, targetPath: string, content: string, mode: number, context: IoContext) {\n await writeFileAtomic(fs, targetPath, content, context);\n await nodeHost.setMode(targetPath, mode);\n}\n\n/**\n * Fills one seed directory over a FileSystem.\n *\n * Without `force`, a missing file is checked and written inside one queued step\n * per file. The FileSystem has no exclusive create, so a second process writing\n * the same new file at the same instant can be overwritten; the Node-only sync\n * shim keeps its hard-link publication for that case.\n */\nasync function initializePoConfig(\n fs: FileSystem,\n directory: string,\n templates: Readonly<Record<PoSeedFile, string>>,\n options: GlobalPoInitOptions,\n directoryMode: number,\n fileMode: number,\n context: IoContext,\n): Promise<GlobalPoInitResult> {\n await ensureDirectory(fs, path.dirname(directory), directoryMode, context);\n await ensureDirectory(fs, directory, directoryMode, context);\n\n const created: string[] = [];\n const preserved: string[] = [];\n const replaced: string[] = [];\n for (const fileName of GLOBAL_PO_SEED_FILES) {\n const targetPath = path.join(directory, fileName);\n await seedWrites.forKey(path.resolve(targetPath))(async () => {\n const existed = (await classifyTarget(fs, targetPath, context)) === 'file';\n if (existed && !options.force) {\n preserved.push(fileName);\n return;\n }\n await publish(fs, targetPath, templates[fileName], fileMode, context);\n (existed ? replaced : created).push(fileName);\n });\n }\n return { directory, created, preserved, replaced };\n}\n\n/**\n * Fills missing global seed files over a FileSystem.\n *\n * Existing files are left alone so that re-running init never discards\n * hand-edited config; pass `force` to overwrite them from the template.\n */\nexport function initializeGlobalPoConfigAsync(\n fs: FileSystem,\n context: IoContext,\n homeDirectory = nodeHost.homeDirectory(),\n options: GlobalPoInitOptions = {},\n): Promise<GlobalPoInitResult> {\n return initializePoConfig(\n fs,\n globalPoConfigDirectory(homeDirectory),\n PO_CONFIG_TEMPLATES,\n options,\n PRIVATE_DIRECTORY_MODE,\n PRIVATE_FILE_MODE,\n context,\n );\n}\n\n/** Seeds repository-local configuration over a FileSystem without creating or changing Pi settings. */\nexport function initializeRepositoryPoConfigAsync(\n fs: FileSystem,\n repositoryRoot: string,\n context: IoContext,\n options: RepositoryPoInitOptions = {},\n): Promise<RepositoryPoInitResult> {\n return initializePoConfig(\n fs,\n path.join(path.resolve(repositoryRoot), PO_DIRECTORY),\n REPOSITORY_PO_CONFIG_TEMPLATES,\n options,\n REPOSITORY_DIRECTORY_MODE,\n REPOSITORY_FILE_MODE,\n context,\n );\n}\n"],"mappings":";;;;;;;;AAOA,MAAa,uBAAuB;CAAC;CAAe;CAAc;CAAgB;AAAe;;AAKjG,MAAa,sBAA4D;CACvE,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA4Bf,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAwGd,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAyDhB,iBAAiB;;;;;;;;;;;;;;;;;;;;;AAqBnB;;AAGA,MAAa,iCAAuE;CAClF,eAAe,oBAAoB;CACnC,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAqEd,gBAAgB;;;;;;;;;;;CAWhB,iBAAiB;;;;;AAKnB;;;AClSA,MAAM,gBAAgB;AACtB,MAAM,sBAAsB;AAC5B,MAAM,iBAAiB;AAEvB,SAAS,UAAU,OAAoC;CACrD,IAAI,EAAE,iBAAiB,QAAQ,OAAO,KAAA;CACtC,MAAM,OAAQ,MAAgC;CAC9C,OAAO,OAAO,SAAS,WAAW,OAAO,KAAA;AAC3C;AAEA,SAASA,kBAAgB,WAAmB,MAAoB;CAC9D,IAAI;CACJ,IAAI;EACF,QAAQ,GAAG,UAAU,SAAS;CAChC,SAAS,OAAO;EACd,IAAI,UAAU,KAAK,MAAM,gBAAgB,MAAM;EAC/C,IAAI;GACF,GAAG,UAAU,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;EAAE;EAAW;EAAS;EAAW;CAAS;AACnD;;;;;;;AAQA,SAAgB,8BACd,IACA,SACA,gBAAgB,SAAS,cAAc,GACvC,UAA+B,CAAC,GACH;CAC7B,OAAO,mBACL,IACA,wBAAwB,aAAa,GACrC,qBACA,SAAA,KAAA,KAGA,OACF;AACF;;AAGA,SAAgB,kCACd,IACA,gBACA,SACA,UAAmC,CAAC,GACH;CACjC,OAAO,mBACL,IACA,KAAK,KAAK,KAAK,QAAQ,cAAc,GAAA,KAAe,GACpD,gCACA,SAAA,KAAA,KAGA,OACF;AACF"}
|
package/dist/init.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_init = require("./init-
|
|
2
|
+
const require_init = require("./init-BdZ-gqqk.cjs");
|
|
3
3
|
exports.GLOBAL_PO_SEED_FILES = require_init.GLOBAL_PO_SEED_FILES;
|
|
4
4
|
exports.PO_CONFIG_TEMPLATES = require_init.PO_CONFIG_TEMPLATES;
|
|
5
5
|
exports.REPOSITORY_PO_CONFIG_TEMPLATES = require_init.REPOSITORY_PO_CONFIG_TEMPLATES;
|
package/dist/init.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { a as GLOBAL_PO_SEED_FILES, o as PO_CONFIG_TEMPLATES, s as REPOSITORY_PO_CONFIG_TEMPLATES, r as initializeGlobalPoConfig, t as initializeGlobalPoConfigAsync, i as initializeRepositoryPoConfig, n as initializeRepositoryPoConfigAsync } from "./init-
|
|
1
|
+
export { a as GLOBAL_PO_SEED_FILES, o as PO_CONFIG_TEMPLATES, s as REPOSITORY_PO_CONFIG_TEMPLATES, r as initializeGlobalPoConfig, t as initializeGlobalPoConfigAsync, i as initializeRepositoryPoConfig, n as initializeRepositoryPoConfigAsync } from "./init-DG7MxGxC.mjs";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agimon-ai/po-config",
|
|
3
|
-
"version": "0.0.0-alpha.
|
|
3
|
+
"version": "0.0.0-alpha.7",
|
|
4
4
|
"description": "Typed configuration loading, validation, and host services for composing Po sessions.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"agent-configuration",
|
|
@@ -139,15 +139,15 @@
|
|
|
139
139
|
"registry": "https://registry.npmjs.org/"
|
|
140
140
|
},
|
|
141
141
|
"dependencies": {
|
|
142
|
-
"@agimon-ai/po-core": "0.0.0-alpha.
|
|
143
|
-
"@agimon-ai/po-telemetry": "0.0.0-alpha.
|
|
144
|
-
"@agimon-ai/po-web-components": "0.0.0-alpha.
|
|
142
|
+
"@agimon-ai/po-core": "0.0.0-alpha.7",
|
|
143
|
+
"@agimon-ai/po-telemetry": "0.0.0-alpha.7",
|
|
144
|
+
"@agimon-ai/po-web-components": "0.0.0-alpha.7",
|
|
145
145
|
"@deepseek-ai/cordis": "4.0.4",
|
|
146
146
|
"typebox": "1.3.37",
|
|
147
147
|
"yaml": "2.9.1"
|
|
148
148
|
},
|
|
149
149
|
"devDependencies": {
|
|
150
|
-
"@agimon-ai/po-build": "0.0.0-alpha.
|
|
150
|
+
"@agimon-ai/po-build": "0.0.0-alpha.7",
|
|
151
151
|
"@earendil-works/pi-coding-agent": "1.2.0",
|
|
152
152
|
"@modelcontextprotocol/ext-apps": "2.0.3",
|
|
153
153
|
"@modelcontextprotocol/server": "2.3.1",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"init-1Iwjz2pM.cjs","names":["ensureDirectory","fs","path","classifyTarget","nodeHost","randomUUID","initializePoConfig","globalPoConfigDirectory","createSerialRunner","nodeHost","getOrThrow","writeFileAtomic","path","globalPoConfigDirectory"],"sources":["../src/services/init/templates.ts","../src/services/init/sync.ts","../src/services/init/index.ts"],"sourcesContent":["export const PRIVATE_DIRECTORY_MODE = 0o700;\nexport const PRIVATE_FILE_MODE = 0o600;\nexport const REPOSITORY_DIRECTORY_MODE = 0o755;\nexport const REPOSITORY_FILE_MODE = 0o644;\nexport const PO_DIRECTORY = '.po';\n\n/** The global seed files are processed in this fixed order. */\nexport const GLOBAL_PO_SEED_FILES = ['config.yaml', 'modes.yaml', 'domains.yaml', 'profiles.yaml'] as const;\n\nexport type PoSeedFile = (typeof GLOBAL_PO_SEED_FILES)[number];\n\n/** Portable defaults for a new global Po configuration directory. */\nexport const PO_CONFIG_TEMPLATES: Readonly<Record<PoSeedFile, string>> = {\n 'config.yaml': `projectTrust: ask\n\n# Autonomous voice is opt-in and uses an explicitly configured Pi model.\n# voice:\n# autoCapture:\n# model: provider/model-id\n# startPhrases:\n# - hey po\n# stopPhrases:\n# - stop speaking\n# utteranceIdleMs: 3000\n# # Long prompts only: open a draft, keep talking, then send it in one piece.\n# # Short utterances are delivered as you finish them and need no phrase.\n# composeOpenPhrases:\n# - hey po\n# composeSendPhrases:\n# - that's it\n# composeCancelPhrases:\n# - scratch that\n# # Endpoint window while a draft collects, so a short command lands on its own.\n# composeUtteranceIdleMs: 1200\n# # Silence before Voice reminds you a draft is open. 0 turns the reminder off.\n# composeNudgeMs: 10000\n# tts:\n# engine: macos-say\n# voice: Samantha\n# rate: 190\n`,\n 'modes.yaml': `# A layer is a reusable named bundle of packages, built-in or local extensions,\n# and hook groups. Major modes below choose which layers load together for a session.\n#\n# Layers and modes defined here apply to every repository. A repository's own\n# .po/modes.yaml is read after this file and replaces any layer or mode of the\n# same name, so a repository can override one entry without restating the rest.\n#\n# Add a layer by giving it a unique name under layers. Local Pi scripts belong\n# under extensions, while installed Pi packages belong under packages:\n# review-tools:\n# extensions:\n# - './extensions/local-review.ts'\n# packages:\n# - '@scope/review-extension'\n# A bare extension name selects a Po built-in. A path beginning with ./ or\n# ../ loads a custom script or extension directory. A bare package loads its\n# ordered package.json pi.extensions entries, while an exported subpath selects\n# one adapter. Relative paths resolve beside this file here (~/.po), or\n# from the repository root in .po/modes.yaml.\n#\n# Use a package mapping when that package accepts configuration. Configuration\n# belongs under the package entry that consumes it, not beside packages.\n# The top-level default bundle loads before every major mode. Replace this whole\n# packages list to customize the distribution defaults. Po core packages\n# remain active independently of this list.\ndefault:\n packages:\n - '@agimon-ai/po-help'\n - '@agimon-ai/po-hook'\n - '@agimon-ai/po-goal'\n - '@agimon-ai/po-voice'\n - '@agimon-ai/po-runner'\n - '@agimon-ai/po-read'\n - '@agimon-ai/po-grep'\n - '@agimon-ai/po-edit'\n - '@agimon-ai/po-file-edit'\n - '@agimon-ai/po-autocompact'\n - '@agimon-ai/po-loop'\n - '@agimon-ai/po-plan'\n - '@agimon-ai/po-workflow'\n - '@agimon-ai/po-log'\n - '@agimon-ai/po-mcp'\n - '@agimon-ai/po-template-elegant'\n - '@agimon-ai/po-prompt'\n - '@agimon-ai/po-author'\n - '@agimon-ai/po-computer-use'\nlayers:\n team:\n packages:\n - name: '@agimon-ai/po-team'\n # Optional Team configuration. Uncomment and choose models available to Pi.\n # config:\n # models:\n # - model: openai-codex/gpt-5.6-luna\n # thinking: xhigh\n # # Tool names excluded from subagents launched by this package. These\n # # remove model-visible tools while preserving hidden team transport.\n # excludeTools: [ask_user_question, intercom, subagent]\n ask-user:\n packages:\n - '@agimon-ai/po-user-feedback'\n task:\n packages:\n - '@agimon-ai/po-task'\n browser:\n packages:\n - '@agimon-ai/po-browse'\n design:\n packages:\n - '@agimon-ai/po-style-system'\n image-gen:\n packages:\n - '@agimon-ai/po-image-gen'\n llm:\n packages:\n - '@agimon-ai/po-model-guidance'\n sandbox:\n packages:\n - '@agimon-ai/po-sandbox'\n source-control:\n packages:\n - '@agimon-ai/po-git'\n template:\n packages:\n - '@agimon-ai/po-template-advanced'\n web-search:\n packages:\n - '@agimon-ai/po-web-search'\n# A major mode explains when it should be used and names its ordered layers.\n# Add another entry under majorMode, then select it with\n# po --major-mode <name>. Change defaultMajorMode to make it the default.\ndefaultMajorMode: copilot\nmajorMode:\n minimal:\n description: Lean mode with Team delegation and persistent tasks.\n layers: [team, task]\n copilot:\n description: General-purpose coding mode with Team delegation, persistent tasks, supervised commands, and structured user feedback.\n layers: [team, ask-user, task, browser, design, image-gen, llm, sandbox, source-control, template, web-search]\n # review:\n # description: Focused review mode for inspecting changes and reporting risks.\n # layers: [team, task, ask-user]\n`,\n 'domains.yaml': `# Plugins are named once in this catalog, then selected by one or more domains.\n# Po automatically inspects personal and repository Codex marketplaces.\n# Each configured root may also be a folder whose direct children are plugins;\n# use roots: [plugins] to discover a repository plugin folder without one entry\n# per plugin. Discovery never scans recursively.\ndefaultDomains: [default]\nplugins:\n roots: []\n entries: {}\n # Local paths resolve beside this file in ~/.po. Repository paths in a\n # repository .po/domains.yaml resolve from that repository root.\n # entries:\n # development:\n # source: local\n # path: plugins/development\n # remote-review:\n # source: url\n # url: https://github.com/acme/review-plugin.git\n # ref: v1.2.0\n # published-review:\n # source: npm\n # package: '@acme/review-plugin'\n # version: 1.2.0\n# Domains carry descriptions and refer to catalog names, not filesystem paths.\ndomains:\n default:\n description: Shared skills and repository MCP only.\n plugins: []\n # development:\n # description: TypeScript implementation and review tools.\n # plugins:\n # - development\n # # Mapping form can load only selected resources from a shared plugin.\n # - name: remote-review\n # skills: [typescript]\n # agents: [reviewer]\n # hooks: false\n # mcp: true\n # # Set false only when this domain should omit shared .claude/skills.\n # sharedSkills: false\n # # Domain mcp is an allowlist over servers configured elsewhere, not a\n # # request to start new ones. Listing servers here drops the tool schemas\n # # of the ones left out, usually the largest context saving a domain can\n # # make. Run po --explain to see the token cost before and after.\n # # Filtering applies only when every selected domain declares mcp, so a\n # # selection mixing this with a domain that omits it stays unfiltered.\n # mcp:\n # servers: [code-intel]\n # proxy: [repository-search]\n# Select it with po --domains development, or add it to defaultDomains.\n#\n# Aliases let one selection enable multiple domains. Replace the empty mapping\n# below with entries like the commented example.\naliases: {}\n# aliases:\n# work: [default, development]\n`,\n 'profiles.yaml': `# Profiles select a persona and optional environment defaults for a session.\n# Each configured root may itself be a profile or contain direct-child profile\n# folders. A folder is discovered when it contains profile.md, SOUL.md, or\n# AGENTS.md; discovery never scans recursively.\nprofiles:\n roots: []\n entries: {}\n # Roots resolve beside this file in ~/.po. Repository roots in a\n # repository .po/profiles.yaml resolve from that repository root.\n # roots: [agents/acme]\n # Explicit entries override an automatically discovered folder of the same\n # name. Environment values must be strings; already exported values win.\n # entries:\n # writer:\n # persona: agents/special/writer\n # env:\n # BRAND: acme\n # TONE: concise\n# Po Pi concatenates profile.md, SOUL.md, then AGENTS.md for the persona.\n# Select one with: po --profile writer\n`,\n};\n\n/** Standalone defaults for a repository that is trying Po through Po. */\nexport const REPOSITORY_PO_CONFIG_TEMPLATES: Readonly<Record<PoSeedFile, string>> = {\n 'config.yaml': PO_CONFIG_TEMPLATES['config.yaml'],\n 'modes.yaml': `# Repository-local layers and major modes. These entries override personal\n# entries with the same name from ~/.po/modes.yaml.\n# This repository-local default replaces the personal top-level default as one\n# whole package list. Edit it to customize the standalone package baseline.\ndefault:\n packages:\n - '@agimon-ai/po-help'\n - '@agimon-ai/po-hook'\n - '@agimon-ai/po-goal'\n - '@agimon-ai/po-voice'\n - '@agimon-ai/po-runner'\n - '@agimon-ai/po-read'\n - '@agimon-ai/po-grep'\n - '@agimon-ai/po-edit'\n - '@agimon-ai/po-file-edit'\n - '@agimon-ai/po-autocompact'\n - '@agimon-ai/po-loop'\n - '@agimon-ai/po-plan'\n - '@agimon-ai/po-workflow'\n - '@agimon-ai/po-log'\n - '@agimon-ai/po-mcp'\n - '@agimon-ai/po-template-elegant'\n - '@agimon-ai/po-prompt'\n - '@agimon-ai/po-author'\n - '@agimon-ai/po-computer-use'\nlayers:\n team:\n packages:\n - name: '@agimon-ai/po-team'\n ask-user:\n packages:\n - '@agimon-ai/po-user-feedback'\n task:\n packages:\n - '@agimon-ai/po-task'\n browser:\n packages:\n - '@agimon-ai/po-browse'\n design:\n packages:\n - '@agimon-ai/po-style-system'\n image-gen:\n packages:\n - '@agimon-ai/po-image-gen'\n llm:\n packages:\n - '@agimon-ai/po-model-guidance'\n sandbox:\n packages:\n - '@agimon-ai/po-sandbox'\n source-control:\n packages:\n - '@agimon-ai/po-git'\n template:\n packages:\n - '@agimon-ai/po-template-advanced'\n web-search:\n packages:\n - '@agimon-ai/po-web-search'\ndefaultMajorMode: copilot\nmajorMode:\n minimal:\n description: Lean mode with Team delegation and persistent tasks.\n layers: [team, task]\n copilot:\n description: General-purpose coding mode with delegation, persistent tasks, supervised commands, and structured user feedback.\n layers: [team, ask-user, task, browser, design, image-gen, llm, sandbox, source-control, template, web-search]\n`,\n 'domains.yaml': `# Repository-local plugin catalog and domain selection.\ndefaultDomains: [default]\nplugins:\n roots: []\n entries: {}\ndomains:\n default:\n description: Shared skills and repository MCP only.\n plugins: []\naliases: {}\n`,\n 'profiles.yaml': `# Repository-local persona roots and environment defaults.\nprofiles:\n roots: []\n entries: {}\n`,\n};\n\n/** Result of filling a Po seed directory. File arrays contain names in seed order. */\nexport interface GlobalPoInitResult {\n directory: string;\n created: string[];\n preserved: string[];\n /** Existing files overwritten from the template. Only ever non-empty under `force`. */\n replaced: string[];\n}\n\nexport interface GlobalPoInitOptions {\n /**\n * Overwrite existing seed files instead of preserving them.\n *\n * Off by default: init is safe to re-run, and hand-edited config is the\n * normal case rather than the exception.\n */\n force?: boolean;\n}\n\nexport type RepositoryPoInitOptions = GlobalPoInitOptions;\nexport type RepositoryPoInitResult = GlobalPoInitResult;\n","import { randomUUID } from 'node:crypto';\nimport fs from 'node:fs';\nimport path from 'node:path';\n\nimport { nodeHost } from '@agimon-ai/po-core/platform';\n\nimport { globalPoConfigDirectory } from '../config';\nimport {\n PO_CONFIG_TEMPLATES,\n PO_DIRECTORY,\n GLOBAL_PO_SEED_FILES,\n PRIVATE_DIRECTORY_MODE,\n PRIVATE_FILE_MODE,\n REPOSITORY_DIRECTORY_MODE,\n REPOSITORY_PO_CONFIG_TEMPLATES,\n REPOSITORY_FILE_MODE,\n type PoSeedFile,\n type GlobalPoInitOptions,\n type GlobalPoInitResult,\n type RepositoryPoInitOptions,\n type RepositoryPoInitResult,\n} from './templates';\n\nconst UTF8_ENCODING = 'utf8';\nconst FILE_ALREADY_EXISTS = 'EEXIST';\nconst FILE_NOT_FOUND = 'ENOENT';\n\nfunction errorCode(error: unknown): string | undefined {\n if (!(error instanceof Error)) return undefined;\n const code = (error as NodeJS.ErrnoException).code;\n return typeof code === 'string' ? code : undefined;\n}\n\nfunction ensureDirectory(directory: string, mode: number): void {\n let stats: fs.Stats;\n try {\n stats = fs.lstatSync(directory);\n } catch (error) {\n if (errorCode(error) !== FILE_NOT_FOUND) throw error;\n try {\n fs.mkdirSync(directory, { mode });\n stats = fs.lstatSync(directory);\n } catch (mkdirError) {\n if (errorCode(mkdirError) !== FILE_ALREADY_EXISTS) throw mkdirError;\n stats = fs.lstatSync(directory);\n }\n }\n\n if (stats.isSymbolicLink()) {\n throw new Error(`Refusing to initialize through symlinked directory: ${directory}`);\n }\n if (!stats.isDirectory()) {\n throw new Error(`Po config path is not a directory: ${directory}`);\n }\n}\n\nfunction ensurePoDirectory(directory: string, mode: number): void {\n ensureDirectory(path.dirname(directory), mode);\n ensureDirectory(directory, mode);\n}\n\nfunction classifyTarget(targetPath: string): 'missing' | 'file' {\n let stats: fs.Stats;\n try {\n stats = fs.lstatSync(targetPath);\n } catch (error) {\n if (errorCode(error) === FILE_NOT_FOUND) return 'missing';\n throw error;\n }\n\n if (stats.isFile()) return 'file';\n if (stats.isSymbolicLink()) {\n try {\n if (fs.statSync(targetPath).isFile()) return 'file';\n } catch (error) {\n throw new Error(`Po config seed symlink is not file-like: ${targetPath}`, { cause: error });\n }\n }\n throw new Error(`Po config seed path is not file-like: ${targetPath}`);\n}\n\nfunction cleanupTemporaryFile(temporaryPath: string): void {\n try {\n fs.unlinkSync(temporaryPath);\n } catch (error) {\n if (errorCode(error) !== FILE_NOT_FOUND) throw error;\n }\n}\n\nfunction publishExclusively(targetPath: string, content: string, mode: number): boolean {\n const temporaryPath = `${targetPath}.${nodeHost.processId()}.${randomUUID()}.tmp`;\n let fileDescriptor: number | undefined;\n try {\n fileDescriptor = fs.openSync(temporaryPath, 'wx', mode);\n fs.writeFileSync(fileDescriptor, content, UTF8_ENCODING);\n fs.fchmodSync(fileDescriptor, mode);\n fs.fsyncSync(fileDescriptor);\n const descriptorToClose = fileDescriptor;\n fileDescriptor = undefined;\n fs.closeSync(descriptorToClose);\n\n try {\n fs.linkSync(temporaryPath, targetPath);\n return true;\n } catch (error) {\n if (errorCode(error) === FILE_ALREADY_EXISTS && classifyTarget(targetPath) === 'file') return false;\n throw error;\n }\n } finally {\n if (fileDescriptor !== undefined) {\n const descriptorToClose = fileDescriptor;\n fileDescriptor = undefined;\n fs.closeSync(descriptorToClose);\n }\n cleanupTemporaryFile(temporaryPath);\n }\n}\n\n/**\n * Replaces a seed file with the template, atomically.\n *\n * The rename swaps the directory entry in one step, so a reader either sees the\n * whole old file or the whole new one. Renaming onto a symlinked seed replaces\n * the link rather than writing through it.\n */\nfunction publishForcefully(targetPath: string, content: string, mode: number): void {\n const temporaryPath = `${targetPath}.${nodeHost.processId()}.${randomUUID()}.tmp`;\n let fileDescriptor: number | undefined;\n try {\n fileDescriptor = fs.openSync(temporaryPath, 'wx', mode);\n fs.writeFileSync(fileDescriptor, content, UTF8_ENCODING);\n fs.fchmodSync(fileDescriptor, mode);\n fs.fsyncSync(fileDescriptor);\n const descriptorToClose = fileDescriptor;\n fileDescriptor = undefined;\n fs.closeSync(descriptorToClose);\n\n fs.renameSync(temporaryPath, targetPath);\n } finally {\n if (fileDescriptor !== undefined) {\n const descriptorToClose = fileDescriptor;\n fileDescriptor = undefined;\n fs.closeSync(descriptorToClose);\n }\n cleanupTemporaryFile(temporaryPath);\n }\n}\n\nfunction initializePoConfig(\n directory: string,\n templates: Readonly<Record<PoSeedFile, string>>,\n options: GlobalPoInitOptions,\n directoryMode: number,\n fileMode: number,\n): GlobalPoInitResult {\n ensurePoDirectory(directory, directoryMode);\n\n const created: string[] = [];\n const preserved: string[] = [];\n const replaced: string[] = [];\n for (const fileName of GLOBAL_PO_SEED_FILES) {\n const targetPath = path.join(directory, fileName);\n const existed = classifyTarget(targetPath) === 'file';\n\n if (options.force) {\n publishForcefully(targetPath, templates[fileName], fileMode);\n (existed ? replaced : created).push(fileName);\n continue;\n }\n if (existed) {\n preserved.push(fileName);\n continue;\n }\n if (publishExclusively(targetPath, templates[fileName], fileMode)) created.push(fileName);\n else preserved.push(fileName);\n }\n\n return { directory, created, preserved, replaced };\n}\n\n/**\n * Fills missing global seed files.\n *\n * Existing files are left alone so that re-running init never discards\n * hand-edited config; pass `force` to overwrite them from the template. A new\n * file is published with an exclusive hard link, so a concurrent writer in\n * another process never loses its file to this one.\n *\n * @deprecated Node-only sync shim; use initializeGlobalPoConfigAsync. Removed in M2.\n */\nexport function initializeGlobalPoConfig(\n homeDirectory = nodeHost.homeDirectory(),\n options: GlobalPoInitOptions = {},\n): GlobalPoInitResult {\n return initializePoConfig(\n globalPoConfigDirectory(homeDirectory),\n PO_CONFIG_TEMPLATES,\n options,\n PRIVATE_DIRECTORY_MODE,\n PRIVATE_FILE_MODE,\n );\n}\n\n/**\n * Seeds repository-local configuration without creating or changing Pi settings.\n *\n * @deprecated Node-only sync shim; use initializeRepositoryPoConfigAsync. Removed in M2.\n */\nexport function initializeRepositoryPoConfig(\n repositoryRoot = process.cwd(),\n options: RepositoryPoInitOptions = {},\n): RepositoryPoInitResult {\n return initializePoConfig(\n path.join(path.resolve(repositoryRoot), PO_DIRECTORY),\n REPOSITORY_PO_CONFIG_TEMPLATES,\n options,\n REPOSITORY_DIRECTORY_MODE,\n REPOSITORY_FILE_MODE,\n );\n}\n","import path from 'node:path';\n\nimport {\n createSerialRunner,\n getOrThrow,\n nodeHost,\n writeFileAtomic,\n type FileSystem,\n} from '@agimon-ai/po-core/platform';\n\nimport { globalPoConfigDirectory } from '../config';\nimport {\n PO_CONFIG_TEMPLATES,\n PO_DIRECTORY,\n GLOBAL_PO_SEED_FILES,\n PRIVATE_DIRECTORY_MODE,\n PRIVATE_FILE_MODE,\n REPOSITORY_DIRECTORY_MODE,\n REPOSITORY_PO_CONFIG_TEMPLATES,\n REPOSITORY_FILE_MODE,\n type PoSeedFile,\n type GlobalPoInitOptions,\n type GlobalPoInitResult,\n type RepositoryPoInitOptions,\n type RepositoryPoInitResult,\n} from './templates';\n\ntype IoContext = Parameters<FileSystem['readTextFile']>[1];\n\nexport {\n PO_CONFIG_TEMPLATES,\n GLOBAL_PO_SEED_FILES,\n REPOSITORY_PO_CONFIG_TEMPLATES,\n type GlobalPoInitOptions,\n type GlobalPoInitResult,\n type RepositoryPoInitOptions,\n type RepositoryPoInitResult,\n} from './templates';\nexport { initializeGlobalPoConfig, initializeRepositoryPoConfig } from './sync';\n\n/** Seed writes in this process are queued per file, so a check and its write are not interleaved. */\nconst seedWrites = createSerialRunner();\n\nasync function ensureDirectory(fs: FileSystem, directory: string, mode: number, context: IoContext): Promise<void> {\n let info = await fs.fileInfo(directory, context);\n if (!info.ok && info.error.code === 'not_found') {\n const created = await fs.createDir(directory, { recursive: false }, context);\n if (created.ok) await nodeHost.setMode(directory, mode);\n info = await fs.fileInfo(directory, context);\n }\n const kind = getOrThrow(info).kind;\n if (kind === 'symlink') throw new Error(`Refusing to initialize through symlinked directory: ${directory}`);\n if (kind !== 'directory') throw new Error(`Po config path is not a directory: ${directory}`);\n}\n\nasync function classifyTarget(fs: FileSystem, targetPath: string, context: IoContext): Promise<'missing' | 'file'> {\n const info = await fs.fileInfo(targetPath, context);\n if (!info.ok && info.error.code === 'not_found') return 'missing';\n const kind = getOrThrow(info).kind;\n if (kind === 'file') return 'file';\n if (kind === 'symlink') {\n try {\n const target = getOrThrow(await fs.canonicalPath(targetPath, context));\n if (getOrThrow(await fs.fileInfo(target, context)).kind === 'file') return 'file';\n } catch (error) {\n throw new Error(`Po config seed symlink is not file-like: ${targetPath}`, { cause: error });\n }\n }\n throw new Error(`Po config seed path is not file-like: ${targetPath}`);\n}\n\nasync function publish(fs: FileSystem, targetPath: string, content: string, mode: number, context: IoContext) {\n await writeFileAtomic(fs, targetPath, content, context);\n await nodeHost.setMode(targetPath, mode);\n}\n\n/**\n * Fills one seed directory over a FileSystem.\n *\n * Without `force`, a missing file is checked and written inside one queued step\n * per file. The FileSystem has no exclusive create, so a second process writing\n * the same new file at the same instant can be overwritten; the Node-only sync\n * shim keeps its hard-link publication for that case.\n */\nasync function initializePoConfig(\n fs: FileSystem,\n directory: string,\n templates: Readonly<Record<PoSeedFile, string>>,\n options: GlobalPoInitOptions,\n directoryMode: number,\n fileMode: number,\n context: IoContext,\n): Promise<GlobalPoInitResult> {\n await ensureDirectory(fs, path.dirname(directory), directoryMode, context);\n await ensureDirectory(fs, directory, directoryMode, context);\n\n const created: string[] = [];\n const preserved: string[] = [];\n const replaced: string[] = [];\n for (const fileName of GLOBAL_PO_SEED_FILES) {\n const targetPath = path.join(directory, fileName);\n await seedWrites.forKey(path.resolve(targetPath))(async () => {\n const existed = (await classifyTarget(fs, targetPath, context)) === 'file';\n if (existed && !options.force) {\n preserved.push(fileName);\n return;\n }\n await publish(fs, targetPath, templates[fileName], fileMode, context);\n (existed ? replaced : created).push(fileName);\n });\n }\n return { directory, created, preserved, replaced };\n}\n\n/**\n * Fills missing global seed files over a FileSystem.\n *\n * Existing files are left alone so that re-running init never discards\n * hand-edited config; pass `force` to overwrite them from the template.\n */\nexport function initializeGlobalPoConfigAsync(\n fs: FileSystem,\n context: IoContext,\n homeDirectory = nodeHost.homeDirectory(),\n options: GlobalPoInitOptions = {},\n): Promise<GlobalPoInitResult> {\n return initializePoConfig(\n fs,\n globalPoConfigDirectory(homeDirectory),\n PO_CONFIG_TEMPLATES,\n options,\n PRIVATE_DIRECTORY_MODE,\n PRIVATE_FILE_MODE,\n context,\n );\n}\n\n/** Seeds repository-local configuration over a FileSystem without creating or changing Pi settings. */\nexport function initializeRepositoryPoConfigAsync(\n fs: FileSystem,\n repositoryRoot: string,\n context: IoContext,\n options: RepositoryPoInitOptions = {},\n): Promise<RepositoryPoInitResult> {\n return initializeP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,WAAW,QAAQ;EAChD,MAAM,WAAW,OAAOA,UAAAA,QAAK,QAAQ,UAAU,CAAC,CAAC,CAAC,YAAY;GAC5D,MAAM,UAAW,MAAM,eAAe,IAAI,YAAY,OAAO,MAAO;GACpE,IAAI,WAAW,CAAC,QAAQ,OAAO;IAC7B,UAAU,KAAK,QAAQ;IACvB;GACF;GACA,MAAM,QAAQ,IAAI,YAAY,UAAU,WAAW,UAAU,OAAO;GACpE,CAAC,UAAU,WAAW,QAAA,CAAS,KAAK,QAAQ;EAC9C,CAAC;CACH;CACA,OAAO;EAAE;EAAW;EAAS;EAAW;CAAS;AACnD;;;;;;;AAQA,SAAgB,8BACd,IACA,SACA,gBAAgBH,4BAAAA,SAAS,cAAc,GACvC,UAA+B,CAAC,GACH;CAC7B,OAAO,mBACL,IACAI,aAAAA,wBAAwB,aAAa,GACrC,qBACA,SAAA,KAAA,KAGA,OACF;AACF;;AAGA,SAAgB,kCACd,IACA,gBACA,SACA,UAAmC,CAAC,GACH;CACjC,OAAO,mBACL,IACAD,UAAAA,QAAK,KAAKA,UAAAA,QAAK,QAAQ,cAAc,GAAA,KAAe,GACpD,gCACA,SAAA,KAAA,KAGA,OACF;AACF"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"init-BqWnULlD.mjs","names":["ensureDirectory","classifyTarget","initializePoConfig"],"sources":["../src/services/init/templates.ts","../src/services/init/sync.ts","../src/services/init/index.ts"],"sourcesContent":["export const PRIVATE_DIRECTORY_MODE = 0o700;\nexport const PRIVATE_FILE_MODE = 0o600;\nexport const REPOSITORY_DIRECTORY_MODE = 0o755;\nexport const REPOSITORY_FILE_MODE = 0o644;\nexport const PO_DIRECTORY = '.po';\n\n/** The global seed files are processed in this fixed order. */\nexport const GLOBAL_PO_SEED_FILES = ['config.yaml', 'modes.yaml', 'domains.yaml', 'profiles.yaml'] as const;\n\nexport type PoSeedFile = (typeof GLOBAL_PO_SEED_FILES)[number];\n\n/** Portable defaults for a new global Po configuration directory. */\nexport const PO_CONFIG_TEMPLATES: Readonly<Record<PoSeedFile, string>> = {\n 'config.yaml': `projectTrust: ask\n\n# Autonomous voice is opt-in and uses an explicitly configured Pi model.\n# voice:\n# autoCapture:\n# model: provider/model-id\n# startPhrases:\n# - hey po\n# stopPhrases:\n# - stop speaking\n# utteranceIdleMs: 3000\n# # Long prompts only: open a draft, keep talking, then send it in one piece.\n# # Short utterances are delivered as you finish them and need no phrase.\n# composeOpenPhrases:\n# - hey po\n# composeSendPhrases:\n# - that's it\n# composeCancelPhrases:\n# - scratch that\n# # Endpoint window while a draft collects, so a short command lands on its own.\n# composeUtteranceIdleMs: 1200\n# # Silence before Voice reminds you a draft is open. 0 turns the reminder off.\n# composeNudgeMs: 10000\n# tts:\n# engine: macos-say\n# voice: Samantha\n# rate: 190\n`,\n 'modes.yaml': `# A layer is a reusable named bundle of packages, built-in or local extensions,\n# and hook groups. Major modes below choose which layers load together for a session.\n#\n# Layers and modes defined here apply to every repository. A repository's own\n# .po/modes.yaml is read after this file and replaces any layer or mode of the\n# same name, so a repository can override one entry without restating the rest.\n#\n# Add a layer by giving it a unique name under layers. Local Pi scripts belong\n# under extensions, while installed Pi packages belong under packages:\n# review-tools:\n# extensions:\n# - './extensions/local-review.ts'\n# packages:\n# - '@scope/review-extension'\n# A bare extension name selects a Po built-in. A path beginning with ./ or\n# ../ loads a custom script or extension directory. A bare package loads its\n# ordered package.json pi.extensions entries, while an exported subpath selects\n# one adapter. Relative paths resolve beside this file here (~/.po), or\n# from the repository root in .po/modes.yaml.\n#\n# Use a package mapping when that package accepts configuration. Configuration\n# belongs under the package entry that consumes it, not beside packages.\n# The top-level default bundle loads before every major mode. Replace this whole\n# packages list to customize the distribution defaults. Po core packages\n# remain active independently of this list.\ndefault:\n packages:\n - '@agimon-ai/po-help'\n - '@agimon-ai/po-hook'\n - '@agimon-ai/po-goal'\n - '@agimon-ai/po-voice'\n - '@agimon-ai/po-runner'\n - '@agimon-ai/po-read'\n - '@agimon-ai/po-grep'\n - '@agimon-ai/po-edit'\n - '@agimon-ai/po-file-edit'\n - '@agimon-ai/po-autocompact'\n - '@agimon-ai/po-loop'\n - '@agimon-ai/po-plan'\n - '@agimon-ai/po-workflow'\n - '@agimon-ai/po-log'\n - '@agimon-ai/po-mcp'\n - '@agimon-ai/po-template-elegant'\n - '@agimon-ai/po-prompt'\n - '@agimon-ai/po-author'\n - '@agimon-ai/po-computer-use'\nlayers:\n team:\n packages:\n - name: '@agimon-ai/po-team'\n # Optional Team configuration. Uncomment and choose models available to Pi.\n # config:\n # models:\n # - model: openai-codex/gpt-5.6-luna\n # thinking: xhigh\n # # Tool names excluded from subagents launched by this package. These\n # # remove model-visible tools while preserving hidden team transport.\n # excludeTools: [ask_user_question, intercom, subagent]\n ask-user:\n packages:\n - '@agimon-ai/po-user-feedback'\n task:\n packages:\n - '@agimon-ai/po-task'\n browser:\n packages:\n - '@agimon-ai/po-browse'\n design:\n packages:\n - '@agimon-ai/po-style-system'\n image-gen:\n packages:\n - '@agimon-ai/po-image-gen'\n llm:\n packages:\n - '@agimon-ai/po-model-guidance'\n sandbox:\n packages:\n - '@agimon-ai/po-sandbox'\n source-control:\n packages:\n - '@agimon-ai/po-git'\n template:\n packages:\n - '@agimon-ai/po-template-advanced'\n web-search:\n packages:\n - '@agimon-ai/po-web-search'\n# A major mode explains when it should be used and names its ordered layers.\n# Add another entry under majorMode, then select it with\n# po --major-mode <name>. Change defaultMajorMode to make it the default.\ndefaultMajorMode: copilot\nmajorMode:\n minimal:\n description: Lean mode with Team delegation and persistent tasks.\n layers: [team, task]\n copilot:\n description: General-purpose coding mode with Team delegation, persistent tasks, supervised commands, and structured user feedback.\n layers: [team, ask-user, task, browser, design, image-gen, llm, sandbox, source-control, template, web-search]\n # review:\n # description: Focused review mode for inspecting changes and reporting risks.\n # layers: [team, task, ask-user]\n`,\n 'domains.yaml': `# Plugins are named once in this catalog, then selected by one or more domains.\n# Po automatically inspects personal and repository Codex marketplaces.\n# Each configured root may also be a folder whose direct children are plugins;\n# use roots: [plugins] to discover a repository plugin folder without one entry\n# per plugin. Discovery never scans recursively.\ndefaultDomains: [default]\nplugins:\n roots: []\n entries: {}\n # Local paths resolve beside this file in ~/.po. Repository paths in a\n # repository .po/domains.yaml resolve from that repository root.\n # entries:\n # development:\n # source: local\n # path: plugins/development\n # remote-review:\n # source: url\n # url: https://github.com/acme/review-plugin.git\n # ref: v1.2.0\n # published-review:\n # source: npm\n # package: '@acme/review-plugin'\n # version: 1.2.0\n# Domains carry descriptions and refer to catalog names, not filesystem paths.\ndomains:\n default:\n description: Shared skills and repository MCP only.\n plugins: []\n # development:\n # description: TypeScript implementation and review tools.\n # plugins:\n # - development\n # # Mapping form can load only selected resources from a shared plugin.\n # - name: remote-review\n # skills: [typescript]\n # agents: [reviewer]\n # hooks: false\n # mcp: true\n # # Set false only when this domain should omit shared .claude/skills.\n # sharedSkills: false\n # # Domain mcp is an allowlist over servers configured elsewhere, not a\n # # request to start new ones. Listing servers here drops the tool schemas\n # # of the ones left out, usually the largest context saving a domain can\n # # make. Run po --explain to see the token cost before and after.\n # # Filtering applies only when every selected domain declares mcp, so a\n # # selection mixing this with a domain that omits it stays unfiltered.\n # mcp:\n # servers: [code-intel]\n # proxy: [repository-search]\n# Select it with po --domains development, or add it to defaultDomains.\n#\n# Aliases let one selection enable multiple domains. Replace the empty mapping\n# below with entries like the commented example.\naliases: {}\n# aliases:\n# work: [default, development]\n`,\n 'profiles.yaml': `# Profiles select a persona and optional environment defaults for a session.\n# Each configured root may itself be a profile or contain direct-child profile\n# folders. A folder is discovered when it contains profile.md, SOUL.md, or\n# AGENTS.md; discovery never scans recursively.\nprofiles:\n roots: []\n entries: {}\n # Roots resolve beside this file in ~/.po. Repository roots in a\n # repository .po/profiles.yaml resolve from that repository root.\n # roots: [agents/acme]\n # Explicit entries override an automatically discovered folder of the same\n # name. Environment values must be strings; already exported values win.\n # entries:\n # writer:\n # persona: agents/special/writer\n # env:\n # BRAND: acme\n # TONE: concise\n# Po Pi concatenates profile.md, SOUL.md, then AGENTS.md for the persona.\n# Select one with: po --profile writer\n`,\n};\n\n/** Standalone defaults for a repository that is trying Po through Po. */\nexport const REPOSITORY_PO_CONFIG_TEMPLATES: Readonly<Record<PoSeedFile, string>> = {\n 'config.yaml': PO_CONFIG_TEMPLATES['config.yaml'],\n 'modes.yaml': `# Repository-local layers and major modes. These entries override personal\n# entries with the same name from ~/.po/modes.yaml.\n# This repository-local default replaces the personal top-level default as one\n# whole package list. Edit it to customize the standalone package baseline.\ndefault:\n packages:\n - '@agimon-ai/po-help'\n - '@agimon-ai/po-hook'\n - '@agimon-ai/po-goal'\n - '@agimon-ai/po-voice'\n - '@agimon-ai/po-runner'\n - '@agimon-ai/po-read'\n - '@agimon-ai/po-grep'\n - '@agimon-ai/po-edit'\n - '@agimon-ai/po-file-edit'\n - '@agimon-ai/po-autocompact'\n - '@agimon-ai/po-loop'\n - '@agimon-ai/po-plan'\n - '@agimon-ai/po-workflow'\n - '@agimon-ai/po-log'\n - '@agimon-ai/po-mcp'\n - '@agimon-ai/po-template-elegant'\n - '@agimon-ai/po-prompt'\n - '@agimon-ai/po-author'\n - '@agimon-ai/po-computer-use'\nlayers:\n team:\n packages:\n - name: '@agimon-ai/po-team'\n ask-user:\n packages:\n - '@agimon-ai/po-user-feedback'\n task:\n packages:\n - '@agimon-ai/po-task'\n browser:\n packages:\n - '@agimon-ai/po-browse'\n design:\n packages:\n - '@agimon-ai/po-style-system'\n image-gen:\n packages:\n - '@agimon-ai/po-image-gen'\n llm:\n packages:\n - '@agimon-ai/po-model-guidance'\n sandbox:\n packages:\n - '@agimon-ai/po-sandbox'\n source-control:\n packages:\n - '@agimon-ai/po-git'\n template:\n packages:\n - '@agimon-ai/po-template-advanced'\n web-search:\n packages:\n - '@agimon-ai/po-web-search'\ndefaultMajorMode: copilot\nmajorMode:\n minimal:\n description: Lean mode with Team delegation and persistent tasks.\n layers: [team, task]\n copilot:\n description: General-purpose coding mode with delegation, persistent tasks, supervised commands, and structured user feedback.\n layers: [team, ask-user, task, browser, design, image-gen, llm, sandbox, source-control, template, web-search]\n`,\n 'domains.yaml': `# Repository-local plugin catalog and domain selection.\ndefaultDomains: [default]\nplugins:\n roots: []\n entries: {}\ndomains:\n default:\n description: Shared skills and repository MCP only.\n plugins: []\naliases: {}\n`,\n 'profiles.yaml': `# Repository-local persona roots and environment defaults.\nprofiles:\n roots: []\n entries: {}\n`,\n};\n\n/** Result of filling a Po seed directory. File arrays contain names in seed order. */\nexport interface GlobalPoInitResult {\n directory: string;\n created: string[];\n preserved: string[];\n /** Existing files overwritten from the template. Only ever non-empty under `force`. */\n replaced: string[];\n}\n\nexport interface GlobalPoInitOptions {\n /**\n * Overwrite existing seed files instead of preserving them.\n *\n * Off by default: init is safe to re-run, and hand-edited config is the\n * normal case rather than the exception.\n */\n force?: boolean;\n}\n\nexport type RepositoryPoInitOptions = GlobalPoInitOptions;\nexport type RepositoryPoInitResult = GlobalPoInitResult;\n","import { randomUUID } from 'node:crypto';\nimport fs from 'node:fs';\nimport path from 'node:path';\n\nimport { nodeHost } from '@agimon-ai/po-core/platform';\n\nimport { globalPoConfigDirectory } from '../config';\nimport {\n PO_CONFIG_TEMPLATES,\n PO_DIRECTORY,\n GLOBAL_PO_SEED_FILES,\n PRIVATE_DIRECTORY_MODE,\n PRIVATE_FILE_MODE,\n REPOSITORY_DIRECTORY_MODE,\n REPOSITORY_PO_CONFIG_TEMPLATES,\n REPOSITORY_FILE_MODE,\n type PoSeedFile,\n type GlobalPoInitOptions,\n type GlobalPoInitResult,\n type RepositoryPoInitOptions,\n type RepositoryPoInitResult,\n} from './templates';\n\nconst UTF8_ENCODING = 'utf8';\nconst FILE_ALREADY_EXISTS = 'EEXIST';\nconst FILE_NOT_FOUND = 'ENOENT';\n\nfunction errorCode(error: unknown): string | undefined {\n if (!(error instanceof Error)) return undefined;\n const code = (error as NodeJS.ErrnoException).code;\n return typeof code === 'string' ? code : undefined;\n}\n\nfunction ensureDirectory(directory: string, mode: number): void {\n let stats: fs.Stats;\n try {\n stats = fs.lstatSync(directory);\n } catch (error) {\n if (errorCode(error) !== FILE_NOT_FOUND) throw error;\n try {\n fs.mkdirSync(directory, { mode });\n stats = fs.lstatSync(directory);\n } catch (mkdirError) {\n if (errorCode(mkdirError) !== FILE_ALREADY_EXISTS) throw mkdirError;\n stats = fs.lstatSync(directory);\n }\n }\n\n if (stats.isSymbolicLink()) {\n throw new Error(`Refusing to initialize through symlinked directory: ${directory}`);\n }\n if (!stats.isDirectory()) {\n throw new Error(`Po config path is not a directory: ${directory}`);\n }\n}\n\nfunction ensurePoDirectory(directory: string, mode: number): void {\n ensureDirectory(path.dirname(directory), mode);\n ensureDirectory(directory, mode);\n}\n\nfunction classifyTarget(targetPath: string): 'missing' | 'file' {\n let stats: fs.Stats;\n try {\n stats = fs.lstatSync(targetPath);\n } catch (error) {\n if (errorCode(error) === FILE_NOT_FOUND) return 'missing';\n throw error;\n }\n\n if (stats.isFile()) return 'file';\n if (stats.isSymbolicLink()) {\n try {\n if (fs.statSync(targetPath).isFile()) return 'file';\n } catch (error) {\n throw new Error(`Po config seed symlink is not file-like: ${targetPath}`, { cause: error });\n }\n }\n throw new Error(`Po config seed path is not file-like: ${targetPath}`);\n}\n\nfunction cleanupTemporaryFile(temporaryPath: string): void {\n try {\n fs.unlinkSync(temporaryPath);\n } catch (error) {\n if (errorCode(error) !== FILE_NOT_FOUND) throw error;\n }\n}\n\nfunction publishExclusively(targetPath: string, content: string, mode: number): boolean {\n const temporaryPath = `${targetPath}.${nodeHost.processId()}.${randomUUID()}.tmp`;\n let fileDescriptor: number | undefined;\n try {\n fileDescriptor = fs.openSync(temporaryPath, 'wx', mode);\n fs.writeFileSync(fileDescriptor, content, UTF8_ENCODING);\n fs.fchmodSync(fileDescriptor, mode);\n fs.fsyncSync(fileDescriptor);\n const descriptorToClose = fileDescriptor;\n fileDescriptor = undefined;\n fs.closeSync(descriptorToClose);\n\n try {\n fs.linkSync(temporaryPath, targetPath);\n return true;\n } catch (error) {\n if (errorCode(error) === FILE_ALREADY_EXISTS && classifyTarget(targetPath) === 'file') return false;\n throw error;\n }\n } finally {\n if (fileDescriptor !== undefined) {\n const descriptorToClose = fileDescriptor;\n fileDescriptor = undefined;\n fs.closeSync(descriptorToClose);\n }\n cleanupTemporaryFile(temporaryPath);\n }\n}\n\n/**\n * Replaces a seed file with the template, atomically.\n *\n * The rename swaps the directory entry in one step, so a reader either sees the\n * whole old file or the whole new one. Renaming onto a symlinked seed replaces\n * the link rather than writing through it.\n */\nfunction publishForcefully(targetPath: string, content: string, mode: number): void {\n const temporaryPath = `${targetPath}.${nodeHost.processId()}.${randomUUID()}.tmp`;\n let fileDescriptor: number | undefined;\n try {\n fileDescriptor = fs.openSync(temporaryPath, 'wx', mode);\n fs.writeFileSync(fileDescriptor, content, UTF8_ENCODING);\n fs.fchmodSync(fileDescriptor, mode);\n fs.fsyncSync(fileDescriptor);\n const descriptorToClose = fileDescriptor;\n fileDescriptor = undefined;\n fs.closeSync(descriptorToClose);\n\n fs.renameSync(temporaryPath, targetPath);\n } finally {\n if (fileDescriptor !== undefined) {\n const descriptorToClose = fileDescriptor;\n fileDescriptor = undefined;\n fs.closeSync(descriptorToClose);\n }\n cleanupTemporaryFile(temporaryPath);\n }\n}\n\nfunction initializePoConfig(\n directory: string,\n templates: Readonly<Record<PoSeedFile, string>>,\n options: GlobalPoInitOptions,\n directoryMode: number,\n fileMode: number,\n): GlobalPoInitResult {\n ensurePoDirectory(directory, directoryMode);\n\n const created: string[] = [];\n const preserved: string[] = [];\n const replaced: string[] = [];\n for (const fileName of GLOBAL_PO_SEED_FILES) {\n const targetPath = path.join(directory, fileName);\n const existed = classifyTarget(targetPath) === 'file';\n\n if (options.force) {\n publishForcefully(targetPath, templates[fileName], fileMode);\n (existed ? replaced : created).push(fileName);\n continue;\n }\n if (existed) {\n preserved.push(fileName);\n continue;\n }\n if (publishExclusively(targetPath, templates[fileName], fileMode)) created.push(fileName);\n else preserved.push(fileName);\n }\n\n return { directory, created, preserved, replaced };\n}\n\n/**\n * Fills missing global seed files.\n *\n * Existing files are left alone so that re-running init never discards\n * hand-edited config; pass `force` to overwrite them from the template. A new\n * file is published with an exclusive hard link, so a concurrent writer in\n * another process never loses its file to this one.\n *\n * @deprecated Node-only sync shim; use initializeGlobalPoConfigAsync. Removed in M2.\n */\nexport function initializeGlobalPoConfig(\n homeDirectory = nodeHost.homeDirectory(),\n options: GlobalPoInitOptions = {},\n): GlobalPoInitResult {\n return initializePoConfig(\n globalPoConfigDirectory(homeDirectory),\n PO_CONFIG_TEMPLATES,\n options,\n PRIVATE_DIRECTORY_MODE,\n PRIVATE_FILE_MODE,\n );\n}\n\n/**\n * Seeds repository-local configuration without creating or changing Pi settings.\n *\n * @deprecated Node-only sync shim; use initializeRepositoryPoConfigAsync. Removed in M2.\n */\nexport function initializeRepositoryPoConfig(\n repositoryRoot = process.cwd(),\n options: RepositoryPoInitOptions = {},\n): RepositoryPoInitResult {\n return initializePoConfig(\n path.join(path.resolve(repositoryRoot), PO_DIRECTORY),\n REPOSITORY_PO_CONFIG_TEMPLATES,\n options,\n REPOSITORY_DIRECTORY_MODE,\n REPOSITORY_FILE_MODE,\n );\n}\n","import path from 'node:path';\n\nimport {\n createSerialRunner,\n getOrThrow,\n nodeHost,\n writeFileAtomic,\n type FileSystem,\n} from '@agimon-ai/po-core/platform';\n\nimport { globalPoConfigDirectory } from '../config';\nimport {\n PO_CONFIG_TEMPLATES,\n PO_DIRECTORY,\n GLOBAL_PO_SEED_FILES,\n PRIVATE_DIRECTORY_MODE,\n PRIVATE_FILE_MODE,\n REPOSITORY_DIRECTORY_MODE,\n REPOSITORY_PO_CONFIG_TEMPLATES,\n REPOSITORY_FILE_MODE,\n type PoSeedFile,\n type GlobalPoInitOptions,\n type GlobalPoInitResult,\n type RepositoryPoInitOptions,\n type RepositoryPoInitResult,\n} from './templates';\n\ntype IoContext = Parameters<FileSystem['readTextFile']>[1];\n\nexport {\n PO_CONFIG_TEMPLATES,\n GLOBAL_PO_SEED_FILES,\n REPOSITORY_PO_CONFIG_TEMPLATES,\n type GlobalPoInitOptions,\n type GlobalPoInitResult,\n type RepositoryPoInitOptions,\n type RepositoryPoInitResult,\n} from './templates';\nexport { initializeGlobalPoConfig, initializeRepositoryPoConfig } from './sync';\n\n/** Seed writes in this process are queued per file, so a check and its write are not interleaved. */\nconst seedWrites = createSerialRunner();\n\nasync function ensureDirectory(fs: FileSystem, directory: string, mode: number, context: IoContext): Promise<void> {\n let info = await fs.fileInfo(directory, context);\n if (!info.ok && info.error.code === 'not_found') {\n const created = await fs.createDir(directory, { recursive: false }, context);\n if (created.ok) await nodeHost.setMode(directory, mode);\n info = await fs.fileInfo(directory, context);\n }\n const kind = getOrThrow(info).kind;\n if (kind === 'symlink') throw new Error(`Refusing to initialize through symlinked directory: ${directory}`);\n if (kind !== 'directory') throw new Error(`Po config path is not a directory: ${directory}`);\n}\n\nasync function classifyTarget(fs: FileSystem, targetPath: string, context: IoContext): Promise<'missing' | 'file'> {\n const info = await fs.fileInfo(targetPath, context);\n if (!info.ok && info.error.code === 'not_found') return 'missing';\n const kind = getOrThrow(info).kind;\n if (kind === 'file') return 'file';\n if (kind === 'symlink') {\n try {\n const target = getOrThrow(await fs.canonicalPath(targetPath, context));\n if (getOrThrow(await fs.fileInfo(target, context)).kind === 'file') return 'file';\n } catch (error) {\n throw new Error(`Po config seed symlink is not file-like: ${targetPath}`, { cause: error });\n }\n }\n throw new Error(`Po config seed path is not file-like: ${targetPath}`);\n}\n\nasync function publish(fs: FileSystem, targetPath: string, content: string, mode: number, context: IoContext) {\n await writeFileAtomic(fs, targetPath, content, context);\n await nodeHost.setMode(targetPath, mode);\n}\n\n/**\n * Fills one seed directory over a FileSystem.\n *\n * Without `force`, a missing file is checked and written inside one queued step\n * per file. The FileSystem has no exclusive create, so a second process writing\n * the same new file at the same instant can be overwritten; the Node-only sync\n * shim keeps its hard-link publication for that case.\n */\nasync function initializePoConfig(\n fs: FileSystem,\n directory: string,\n templates: Readonly<Record<PoSeedFile, string>>,\n options: GlobalPoInitOptions,\n directoryMode: number,\n fileMode: number,\n context: IoContext,\n): Promise<GlobalPoInitResult> {\n await ensureDirectory(fs, path.dirname(directory), directoryMode, context);\n await ensureDirectory(fs, directory, directoryMode, context);\n\n const created: string[] = [];\n const preserved: string[] = [];\n const replaced: string[] = [];\n for (const fileName of GLOBAL_PO_SEED_FILES) {\n const targetPath = path.join(directory, fileName);\n await seedWrites.forKey(path.resolve(targetPath))(async () => {\n const existed = (await classifyTarget(fs, targetPath, context)) === 'file';\n if (existed && !options.force) {\n preserved.push(fileName);\n return;\n }\n await publish(fs, targetPath, templates[fileName], fileMode, context);\n (existed ? replaced : created).push(fileName);\n });\n }\n return { directory, created, preserved, replaced };\n}\n\n/**\n * Fills missing global seed files over a FileSystem.\n *\n * Existing files are left alone so that re-running init never discards\n * hand-edited config; pass `force` to overwrite them from the template.\n */\nexport function initializeGlobalPoConfigAsync(\n fs: FileSystem,\n context: IoContext,\n homeDirectory = nodeHost.homeDirectory(),\n options: GlobalPoInitOptions = {},\n): Promise<GlobalPoInitResult> {\n return initializePoConfig(\n fs,\n globalPoConfigDirectory(homeDirectory),\n PO_CONFIG_TEMPLATES,\n options,\n PRIVATE_DIRECTORY_MODE,\n PRIVATE_FILE_MODE,\n context,\n );\n}\n\n/** Seeds repository-local configuration over a FileSystem without creating or changing Pi settings. */\nexport function initializeRepositoryPoConfigAsync(\n fs: FileSystem,\n repositoryRoot: string,\n context: IoContext,\n options: RepositoryPoInitOptions = {},\n): Promise<RepositoryPoInitResult> {\n return initializePoConfig(\n fs,\n path.join(path.resolve(repositoryRoot), PO_DIRECTORY),\n REPOSITORY_PO_CONFIG_TEMPLATES,\n options,\n REPOSITORY_DIRECTORY_MODE,\n REPOSITORY_FILE_MODE,\n context,\n );\n}\n"],"mappings":";;;;;;;;AAOA,MAAa,uBAAuB;CAAC;CAAe;CAAc;CAAgB;AAAe;;AA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