@geraldmaron/construct 1.2.1 → 1.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -6
- package/bin/construct +41 -67
- package/commands/plan/decide.md +1 -1
- package/commands/remember/runbook.md +1 -1
- package/examples/README.md +1 -1
- package/examples/distribution/README.md +1 -1
- package/examples/distribution/sources/adr.md +2 -2
- package/examples/distribution/sources/deck-one-pager.md +1 -1
- package/examples/distribution/sources/prd-platform.md +1 -1
- package/examples/distribution/sources/research-brief.md +2 -2
- package/examples/distribution/sources/rfc-platform.md +1 -1
- package/examples/distribution/sources/runbook.md +2 -2
- package/examples/distribution/sources/strategy.md +1 -1
- package/lib/agent-instructions/inject.mjs +1 -1
- package/lib/artifact-type-from-path.mjs +9 -5
- package/lib/audit-specialists.mjs +1 -1
- package/lib/audit-trail.mjs +3 -3
- package/lib/auto-docs.mjs +10 -10
- package/lib/bootstrap/built-ins.mjs +3 -3
- package/lib/boundary.mjs +3 -2
- package/lib/brand-prose.mjs +1 -1
- package/lib/cache-governor.js +4 -4
- package/lib/certification/document-io-fixtures.mjs +1 -1
- package/lib/chat/config.mjs +2 -2
- package/lib/chat/desktop-binary.mjs +5 -3
- package/lib/cli-commands.mjs +3 -3
- package/lib/cli-service-inventory.mjs +1 -1
- package/lib/comment-lint.mjs +9 -5
- package/lib/config/alias.mjs +3 -2
- package/lib/config/intake-policy.mjs +8 -78
- package/lib/config/project-config.mjs +95 -5
- package/lib/config/schema.mjs +9 -19
- package/lib/config/xdg.mjs +63 -0
- package/lib/contracts/violation-log.mjs +2 -2
- package/lib/cost-ledger.mjs +4 -3
- package/lib/cost.mjs +3 -2
- package/lib/decisions/registry.mjs +3 -3
- package/lib/distill.mjs +2 -2
- package/lib/docs-verify.mjs +2 -0
- package/lib/doctor/audit.mjs +4 -3
- package/lib/doctor/cli.mjs +0 -1
- package/lib/doctor/index.mjs +4 -4
- package/lib/doctor/report.mjs +3 -3
- package/lib/doctor/watchers/bd-watch.mjs +5 -5
- package/lib/doctor/watchers/cost.mjs +4 -4
- package/lib/doctor/watchers/disk.mjs +4 -3
- package/lib/doctor/watchers/service-health.mjs +5 -5
- package/lib/document-export.mjs +1 -1
- package/lib/document-extract.mjs +3 -3
- package/lib/document-ingest.mjs +13 -3
- package/lib/efficiency.mjs +2 -1
- package/lib/embed/approval-queue.mjs +3 -2
- package/lib/embed/cli.mjs +7 -5
- package/lib/embed/config.mjs +6 -5
- package/lib/embed/daemon.mjs +6 -5
- package/lib/embed/inbox-live-watcher.mjs +1 -1
- package/lib/embed/inbox.mjs +52 -37
- package/lib/embed/intake-metrics.mjs +3 -2
- package/lib/embed/reconcile.mjs +1 -1
- package/lib/embed/semantic.mjs +3 -2
- package/lib/embed/supervision.mjs +4 -2
- package/lib/engine/registry.mjs +3 -3
- package/lib/env-config.mjs +34 -12
- package/lib/features.mjs +4 -3
- package/lib/health-check.mjs +7 -6
- package/lib/hook-health.mjs +5 -4
- package/lib/hooks/_lib/log.mjs +4 -3
- package/lib/hooks/_lib/output-mode.mjs +2 -1
- package/lib/hooks/agent-tracker.mjs +3 -4
- package/lib/hooks/audit-reads.mjs +2 -2
- package/lib/hooks/audit-trail.mjs +2 -2
- package/lib/hooks/bash-output-logger.mjs +3 -3
- package/lib/hooks/brand-prose-lint.mjs +1 -1
- package/lib/hooks/ci-status-check.mjs +3 -2
- package/lib/hooks/context-watch.mjs +2 -2
- package/lib/hooks/context-window-recovery.mjs +5 -5
- package/lib/hooks/dep-audit.mjs +2 -2
- package/lib/hooks/doc-coupling-check.mjs +3 -2
- package/lib/hooks/edit-accumulator.mjs +3 -2
- package/lib/hooks/edit-guard.mjs +3 -3
- package/lib/hooks/guard-bash.mjs +2 -2
- package/lib/hooks/model-fallback.mjs +2 -1
- package/lib/hooks/policy-engine.mjs +4 -3
- package/lib/hooks/pre-compact.mjs +7 -7
- package/lib/hooks/readme-age-check.mjs +2 -2
- package/lib/hooks/session-optimize.mjs +4 -3
- package/lib/hooks/session-start.mjs +6 -5
- package/lib/hooks/stop-notify.mjs +9 -8
- package/lib/hooks/stop-typecheck.mjs +4 -3
- package/lib/hooks/test-watch.mjs +2 -2
- package/lib/host-disposition.mjs +1 -1
- package/lib/ingest/provider-extract.mjs +2 -1
- package/lib/init/detect-existing-structure.mjs +2 -2
- package/lib/init/doc-lanes.mjs +3 -10
- package/lib/init-docs.mjs +12 -54
- package/lib/init-unified.mjs +35 -81
- package/lib/init.mjs +7 -5
- package/lib/install/desktop-binary-download.mjs +5 -2
- package/lib/intake/daemon.mjs +31 -8
- package/lib/intake/intake-config.mjs +5 -32
- package/lib/integrations/intake-integrations.mjs +8 -7
- package/lib/knowledge/rag.mjs +2 -2
- package/lib/knowledge/search.mjs +15 -15
- package/lib/maintenance/cleanup.mjs +14 -10
- package/lib/mcp/server.mjs +1 -1
- package/lib/mcp/tools/project.mjs +2 -1
- package/lib/model-cheapest-provider.mjs +4 -3
- package/lib/model-pricing.mjs +3 -2
- package/lib/model-router.mjs +4 -3
- package/lib/models/catalog.mjs +2 -1
- package/lib/models/execution-capability-profile.mjs +2 -1
- package/lib/models/provider-poll.mjs +2 -1
- package/lib/ollama-manager.mjs +0 -1
- package/lib/op-log.mjs +2 -1
- package/lib/opencode-runtime-plugin.mjs +3 -2
- package/lib/oracle/artifact-gate.mjs +3 -0
- package/lib/oracle/cli.mjs +2 -1
- package/lib/oracle/execute.mjs +3 -2
- package/lib/oracle/index.mjs +2 -1
- package/lib/oracle/read-model.mjs +3 -2
- package/lib/performance/generate.mjs +4 -3
- package/lib/platforms/capabilities.mjs +1 -1
- package/lib/plugin-registry.mjs +2 -1
- package/lib/profiles/lifecycle.mjs +3 -3
- package/lib/project-profile.mjs +2 -1
- package/lib/project-root.mjs +9 -7
- package/lib/provider-capabilities.js +4 -3
- package/lib/providers/auth-manager.mjs +2 -1
- package/lib/providers/copilot-auth.mjs +3 -2
- package/lib/providers/creds.mjs +3 -2
- package/lib/providers/registry.mjs +3 -3
- package/lib/providers/secret-resolver.mjs +3 -2
- package/lib/read-tracker-store.mjs +2 -1
- package/lib/reconcile/mcp-entry-reconcile.mjs +2 -2
- package/lib/reflect.mjs +2 -1
- package/lib/registry/generate-docs.mjs +2 -2
- package/lib/roles/approval-surface.mjs +5 -4
- package/lib/roles/event-bus.mjs +0 -1
- package/lib/roles/gateway.mjs +6 -2
- package/lib/rules-delivery.mjs +1 -1
- package/lib/runtime-pressure.mjs +5 -3
- package/lib/sandbox.mjs +3 -2
- package/lib/scheduler/solo.mjs +6 -4
- package/lib/server/auth.mjs +4 -3
- package/lib/server/index.mjs +24 -26
- package/lib/server/insights.mjs +5 -4
- package/lib/server/webhook.mjs +2 -1
- package/lib/service-manager.mjs +5 -3
- package/lib/setup.mjs +9 -8
- package/lib/status.mjs +6 -5
- package/lib/storage/embeddings-local.mjs +3 -2
- package/lib/storage/sync.mjs +2 -2
- package/lib/telemetry/client.mjs +0 -1
- package/lib/telemetry/intent-verifications.mjs +6 -6
- package/lib/telemetry/model-pricing-catalog.mjs +4 -3
- package/lib/telemetry/rule-calls.mjs +3 -3
- package/lib/telemetry/skill-calls.mjs +3 -3
- package/lib/template-registry.mjs +1 -0
- package/lib/templates/visual-requirements.mjs +1 -1
- package/lib/test-corpus-inventory.mjs +1 -1
- package/lib/uninstall/uninstall.mjs +12 -10
- package/package.json +3 -3
- package/platforms/claude/settings.template.json +43 -43
- package/rules/common/no-fabrication.md +1 -1
- package/rules/common/release-gates.md +1 -1
- package/rules/common/research.md +1 -1
- package/rules/common/review-before-change.md +1 -1
- package/scripts/sync-specialists.mjs +11 -8
- package/skills/docs/adr-workflow.md +3 -3
- package/skills/docs/init-docs.md +9 -9
- package/skills/docs/prd-workflow.md +5 -5
- package/skills/docs/product-intelligence-review.md +1 -1
- package/skills/docs/product-intelligence-workflow.md +2 -2
- package/skills/docs/product-signal-workflow.md +1 -1
- package/skills/docs/runbook-workflow.md +4 -4
- package/skills/exploration/unknown-codebase-onboarding.md +1 -1
- package/skills/operating/orchestration-reference.md +1 -1
- package/skills/routing.md +3 -3
- package/specialists/prompts/cx-architect.md +1 -1
- package/specialists/prompts/cx-docs-keeper.md +1 -1
- package/specialists/prompts/cx-researcher.md +1 -1
- package/specialists/prompts/cx-sre.md +1 -1
- package/specialists/role-manifests.json +6 -6
- package/templates/docs/README.md +125 -0
- package/templates/docs/construct_guide.md +3 -4
- package/templates/docs/persona-artifact.md +1 -1
- package/templates/docs/prds/README.md +25 -0
- package/templates/docs/prds/templates/_template.md +206 -0
- package/templates/docs/prds/templates/meta-prd.template.md +177 -0
- package/templates/docs/prds/templates/prd-business.template.md +61 -0
- package/templates/docs/prds/templates/prd-platform.template.md +81 -0
- package/templates/docs/prds/templates/prfaq.template.md +38 -0
- package/templates/docs/rfcs/README.md +22 -0
- package/templates/docs/rfcs/templates/_template.md +58 -0
- package/templates/docs/rfcs/templates/rfc-platform.template.md +72 -0
- package/templates/homebrew/construct.rb +1 -1
- package/templates/workflows/new-feature.yml +8 -8
- package/lib/intake/legacy-paths.mjs +0 -5
package/lib/embed/inbox.mjs
CHANGED
|
@@ -6,10 +6,14 @@
|
|
|
6
6
|
* handles specs, ADRs, meeting notes, internal docs, research, PDFs,
|
|
7
7
|
* Office files, plain text, code, or any format supported by document-extract.
|
|
8
8
|
*
|
|
9
|
-
* Watch dirs
|
|
10
|
-
* 1.
|
|
11
|
-
* 2.
|
|
12
|
-
*
|
|
9
|
+
* Watch dirs:
|
|
10
|
+
* 1. <rootDir>/inbox/ — the canonical project-root drop zone (always watched)
|
|
11
|
+
* 2. CX_INBOX_DIRS env var + intakePolicy.additionalDirs — opt-in extra paths
|
|
12
|
+
*
|
|
13
|
+
* Atomic handoff (ADR-0045 §C): writers stage a file under `inbox/.staging/`
|
|
14
|
+
* and atomically rename it into `inbox/`. The watcher ignores `.staging/` and
|
|
15
|
+
* dotfiles, and skips any top-level file whose size is still changing between
|
|
16
|
+
* two stats, so a partially-written drop is never consumed mid-write.
|
|
13
17
|
*
|
|
14
18
|
* State tracking:
|
|
15
19
|
* <rootDir>/.cx/runtime/inbox-state.json — maps filePath → processedAt
|
|
@@ -23,7 +27,6 @@
|
|
|
23
27
|
|
|
24
28
|
import { existsSync, mkdirSync, readdirSync, readFileSync, statSync, writeFileSync, appendFileSync } from 'node:fs';
|
|
25
29
|
import { join, resolve, isAbsolute } from 'node:path';
|
|
26
|
-
import { homedir } from 'node:os';
|
|
27
30
|
import { isExtractableDocumentPath, AUDIO_VIDEO_EXTS } from '../document-extract.mjs';
|
|
28
31
|
import { ingestDocuments } from '../document-ingest.mjs';
|
|
29
32
|
import { addObservation } from '../observation-store.mjs';
|
|
@@ -36,29 +39,29 @@ import { loadIntakeConfig, INTAKE_DEFAULT_MAX_DEPTH } from '../intake/intake-con
|
|
|
36
39
|
import { loadManifest, recordFile, hasFile, sha256Of, MANIFEST_REL_PATH } from '../intake/manifest.mjs';
|
|
37
40
|
import { gatherAttribution } from '../intake/attribution.mjs';
|
|
38
41
|
import { acquirePollLock, releasePollLock } from '../intake/poll-lock.mjs';
|
|
42
|
+
import { doctorRoot } from '../config/xdg.mjs';
|
|
39
43
|
|
|
40
44
|
const STATE_FILE = '.cx/runtime/inbox-state.json';
|
|
41
|
-
const
|
|
42
|
-
const
|
|
43
|
-
const ARCHETYPE_INBOX_SUBDIR = 'inbox';
|
|
45
|
+
const ROOT_INBOX_SUBDIR = 'inbox';
|
|
46
|
+
const STAGING_SUBDIR = '.staging';
|
|
44
47
|
const MAX_FILE_SIZE_BYTES = 50 * 1024 * 1024; // 50 MB hard cap
|
|
45
48
|
const STALE_STATE_AGE_MS = 7 * 24 * 60 * 60 * 1000; // 7 days
|
|
46
49
|
|
|
47
50
|
// ─── Extraction-warning helpers ───────────────────────────────────────────────
|
|
48
51
|
|
|
49
52
|
function extractionWarningsLog() {
|
|
50
|
-
return join(
|
|
53
|
+
return join(doctorRoot(), 'intake', 'extraction-warnings.jsonl');
|
|
51
54
|
}
|
|
52
55
|
|
|
53
56
|
function needsAsrDir() {
|
|
54
|
-
return join(
|
|
57
|
+
return join(doctorRoot(), 'intake', 'needs-asr');
|
|
55
58
|
}
|
|
56
59
|
|
|
57
60
|
function writeExtractionWarning({ sourcePath, droppedInfo }) {
|
|
58
61
|
if (!droppedInfo?.length) return;
|
|
59
62
|
const logPath = extractionWarningsLog();
|
|
60
63
|
try {
|
|
61
|
-
mkdirSync(join(
|
|
64
|
+
mkdirSync(join(doctorRoot(), 'intake'), { recursive: true });
|
|
62
65
|
const line = JSON.stringify({ ts: new Date().toISOString(), sourcePath, droppedInfo }) + '\n';
|
|
63
66
|
appendFileSync(logPath, line);
|
|
64
67
|
} catch { /* non-fatal */ }
|
|
@@ -139,31 +142,20 @@ function writeState(rootDir, state) {
|
|
|
139
142
|
|
|
140
143
|
/**
|
|
141
144
|
* Resolve inbox watch directories from the persisted intake-config.
|
|
142
|
-
*
|
|
143
|
-
* config
|
|
144
|
-
*
|
|
145
|
-
*
|
|
145
|
+
* The canonical <rootDir>/inbox/ is always watched (ADR-0045 §C). `parentDirs`
|
|
146
|
+
* from intake-config plus CX_INBOX_DIRS env var add opt-in extras.
|
|
147
|
+
*
|
|
148
|
+
* The canonical inbox gets a `.staging/` subdir on resolution so writers have
|
|
149
|
+
* a stable place to assemble a file before the atomic rename into `inbox/`.
|
|
146
150
|
*/
|
|
147
151
|
export function resolveInboxDirs(rootDir, env = process.env) {
|
|
148
152
|
const config = loadIntakeConfig(rootDir, env);
|
|
149
153
|
const dirs = [];
|
|
150
154
|
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
if (config.includeProjectInbox) {
|
|
158
|
-
const projectInbox = join(rootDir, DEFAULT_INBOX_SUBDIR);
|
|
159
|
-
mkdirSync(projectInbox, { recursive: true });
|
|
160
|
-
dirs.push(projectInbox);
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
if (config.includeDocsIntake) {
|
|
164
|
-
const docsIntake = join(rootDir, DOCS_INTAKE_SUBDIR);
|
|
165
|
-
if (existsSync(docsIntake)) dirs.push(docsIntake);
|
|
166
|
-
}
|
|
155
|
+
const rootInbox = join(rootDir, ROOT_INBOX_SUBDIR);
|
|
156
|
+
mkdirSync(rootInbox, { recursive: true });
|
|
157
|
+
mkdirSync(join(rootInbox, STAGING_SUBDIR), { recursive: true });
|
|
158
|
+
dirs.push(rootInbox);
|
|
167
159
|
|
|
168
160
|
for (const candidate of config.parentDirs) {
|
|
169
161
|
if (!candidate) continue;
|
|
@@ -177,6 +169,20 @@ export function resolveInboxDirs(rootDir, env = process.env) {
|
|
|
177
169
|
|
|
178
170
|
// ─── File scanning ────────────────────────────────────────────────────────────
|
|
179
171
|
|
|
172
|
+
// Dotfiles and dot-directories — including the `inbox/.staging/` assembly
|
|
173
|
+
// area writers rename out of — are skipped wholesale, so a staged file is
|
|
174
|
+
// never visible to the scanner until it lands at a top-level name.
|
|
175
|
+
|
|
176
|
+
function isStableFile(full) {
|
|
177
|
+
try {
|
|
178
|
+
const a = statSync(full);
|
|
179
|
+
const b = statSync(full);
|
|
180
|
+
return a.size === b.size && a.mtimeMs === b.mtimeMs ? a : null;
|
|
181
|
+
} catch {
|
|
182
|
+
return null;
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
|
|
180
186
|
/**
|
|
181
187
|
* Walk `dir` up to `maxDepth` subdirectory levels.
|
|
182
188
|
* maxDepth=0 → only files in `dir` itself (no subdirs).
|
|
@@ -198,11 +204,15 @@ function scanDir(dir, maxDepth = INTAKE_DEFAULT_MAX_DEPTH) {
|
|
|
198
204
|
}
|
|
199
205
|
if (!entry.isFile()) continue;
|
|
200
206
|
if (!isExtractableDocumentPath(full)) continue;
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
207
|
+
|
|
208
|
+
// Stability backstop for writers that drop in place instead of staging:
|
|
209
|
+
// a file whose size/mtime is still moving between two stats is mid-write,
|
|
210
|
+
// so leave it for the next poll once it settles.
|
|
211
|
+
|
|
212
|
+
const st = isStableFile(full);
|
|
213
|
+
if (!st) continue;
|
|
214
|
+
if (st.size === 0 || st.size > MAX_FILE_SIZE_BYTES) continue;
|
|
215
|
+
results.push({ path: full, size: st.size, mtimeMs: st.mtimeMs });
|
|
206
216
|
}
|
|
207
217
|
}
|
|
208
218
|
} catch (err) { process.stderr.write('[inbox.mjs] scan-dir: ' + (err?.message ?? String(err)) + '\n'); }
|
|
@@ -269,7 +279,12 @@ function maybePromoteToDocs(rootDir, { sourcePath, extractedText }) {
|
|
|
269
279
|
if (!existsSync(laneDir)) return null;
|
|
270
280
|
|
|
271
281
|
const sourceName = sourcePath.split('/').pop() ?? 'intake-doc';
|
|
272
|
-
|
|
282
|
+
|
|
283
|
+
// A source already in markdown keeps its name; others gain a .md rendering
|
|
284
|
+
// suffix. Without the guard an intake item named foo.md promotes to foo.md.md.
|
|
285
|
+
|
|
286
|
+
const docFileName = /\.md$/i.test(sourceName) ? sourceName : `${sourceName}.md`;
|
|
287
|
+
const targetPath = nextAvailablePath(join(laneDir, docFileName));
|
|
273
288
|
const title = sourceName.replace(/\.[^.]+$/, '').replace(/[-_]+/g, ' ').trim() || 'Promoted intake document';
|
|
274
289
|
const markdown = [
|
|
275
290
|
'# ' + title,
|
|
@@ -16,7 +16,8 @@
|
|
|
16
16
|
|
|
17
17
|
import { existsSync, readFileSync, readdirSync, statSync } from 'node:fs';
|
|
18
18
|
import { join } from 'node:path';
|
|
19
|
-
|
|
19
|
+
|
|
20
|
+
import { doctorRoot } from '../config/xdg.mjs';
|
|
20
21
|
|
|
21
22
|
/**
|
|
22
23
|
* Scan an intake directory and return file metadata.
|
|
@@ -125,7 +126,7 @@ export function computeIntakeMetrics({ rootDir } = {}) {
|
|
|
125
126
|
// — Metrics from recommendation store
|
|
126
127
|
let recStats = { active: 0, dismissed: 0, total: 0 };
|
|
127
128
|
try {
|
|
128
|
-
const recIndexPath = join(
|
|
129
|
+
const recIndexPath = join(doctorRoot(), 'intake', 'recommendations-index.json');
|
|
129
130
|
if (existsSync(recIndexPath)) {
|
|
130
131
|
const index = JSON.parse(readFileSync(recIndexPath, 'utf8'));
|
|
131
132
|
const entries = Object.values(index);
|
package/lib/embed/reconcile.mjs
CHANGED
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
* with no changes re-embeds nothing.
|
|
13
13
|
*
|
|
14
14
|
* Reconciliation-on-sync is preferred over a fixed-interval polling cron (see
|
|
15
|
-
* docs/research/vector-search-best-practices.md): the pass runs where Construct
|
|
15
|
+
* docs/notes/research/vector-search-best-practices.md): the pass runs where Construct
|
|
16
16
|
* already touches storage (the model-change re-embed, the storage CLI), keys
|
|
17
17
|
* idempotency on a content hash, and re-embeds on model change.
|
|
18
18
|
*/
|
package/lib/embed/semantic.mjs
CHANGED
|
@@ -21,9 +21,10 @@
|
|
|
21
21
|
import { existsSync, mkdirSync, readFileSync, writeFileSync, readdirSync } from 'node:fs';
|
|
22
22
|
import { join } from 'node:path';
|
|
23
23
|
import { createHash, randomUUID } from 'node:crypto';
|
|
24
|
-
import { homedir } from 'node:os';
|
|
25
24
|
|
|
26
|
-
|
|
25
|
+
import { doctorRoot } from '../config/xdg.mjs';
|
|
26
|
+
|
|
27
|
+
const CACHE_DIR = join(doctorRoot(), 'cache', 'embeddings');
|
|
27
28
|
const INDEX_FILE = join(CACHE_DIR, 'index.json');
|
|
28
29
|
const MODEL_NAME = 'Xenova/all-MiniLM-L6-v2';
|
|
29
30
|
const DIMENSIONS = 384;
|
|
@@ -21,13 +21,15 @@ import os from 'node:os';
|
|
|
21
21
|
import path from 'node:path';
|
|
22
22
|
import { spawnSync } from 'node:child_process';
|
|
23
23
|
|
|
24
|
+
import { stateDir, doctorRoot } from '../config/xdg.mjs';
|
|
25
|
+
|
|
24
26
|
const HOME = os.homedir();
|
|
25
27
|
const PLATFORM = process.platform;
|
|
26
28
|
const NODE_BIN = process.execPath;
|
|
27
29
|
|
|
28
30
|
// Path to the construct bin — we use absolute path so launchd/systemd can find it.
|
|
29
31
|
function constructBin() {
|
|
30
|
-
const local = path.join(HOME, '
|
|
32
|
+
const local = path.join(stateDir(HOME), 'bin', 'construct');
|
|
31
33
|
if (fs.existsSync(local)) return local;
|
|
32
34
|
const result = spawnSync('which', ['construct'], { encoding: 'utf8' });
|
|
33
35
|
return result.status === 0 ? result.stdout.trim() : 'construct';
|
|
@@ -195,7 +197,7 @@ function windowsStatus() {
|
|
|
195
197
|
// ── Public API ──────────────────────────────────────────────────────────────
|
|
196
198
|
|
|
197
199
|
function logPath() {
|
|
198
|
-
return path.join(
|
|
200
|
+
return path.join(doctorRoot(), 'runtime', 'embed-daemon.log');
|
|
199
201
|
}
|
|
200
202
|
|
|
201
203
|
/**
|
package/lib/engine/registry.mjs
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Resolution order (last-write wins):
|
|
5
5
|
* 1. Built-in defaults (lib/engine/defaults.mjs)
|
|
6
|
-
* 2.
|
|
6
|
+
* 2. plugins.json in the XDG config dir (operator-level overrides)
|
|
7
7
|
* 3. <project>/.cx/plugins.json (repo-level overrides)
|
|
8
8
|
* 4. CONSTRUCT_PLUGIN_<LAYER> environment variables (one-off overrides)
|
|
9
9
|
*
|
|
@@ -20,11 +20,11 @@
|
|
|
20
20
|
*/
|
|
21
21
|
|
|
22
22
|
import { readFileSync, existsSync } from 'node:fs';
|
|
23
|
-
import { homedir } from 'node:os';
|
|
24
23
|
import { join, isAbsolute, resolve } from 'node:path';
|
|
25
24
|
import { pathToFileURL } from 'node:url';
|
|
26
25
|
import { LAYERS, assertContract } from './contracts.mjs';
|
|
27
26
|
import { loadDefaults } from './defaults.mjs';
|
|
27
|
+
import { configDir } from '../config/xdg.mjs';
|
|
28
28
|
|
|
29
29
|
const ENV_PREFIX = 'CONSTRUCT_PLUGIN_';
|
|
30
30
|
|
|
@@ -43,7 +43,7 @@ function readJsonIfExists(path) {
|
|
|
43
43
|
function gatherOverrides(rootDir) {
|
|
44
44
|
const overrides = [];
|
|
45
45
|
|
|
46
|
-
const userConfig = readJsonIfExists(join(
|
|
46
|
+
const userConfig = readJsonIfExists(join(configDir(), 'plugins.json'));
|
|
47
47
|
if (userConfig?.plugins) overrides.push(...userConfig.plugins);
|
|
48
48
|
|
|
49
49
|
const projectConfig = readJsonIfExists(join(rootDir, '.cx', 'plugins.json'));
|
package/lib/env-config.mjs
CHANGED
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* lib/env-config.mjs — Read and write Construct environment configuration files.
|
|
3
3
|
*
|
|
4
|
-
* Provides helpers to load
|
|
5
|
-
* key/value pairs back to disk.
|
|
6
|
-
*
|
|
4
|
+
* Provides helpers to load the user config.env (XDG config dir) and a project
|
|
5
|
+
* .env, merge them with process.env, and persist key/value pairs back to disk.
|
|
6
|
+
* Project .env wins over user config.env, which wins over shell exports. Backs
|
|
7
|
+
* setup, model-router, and the MCP server when they resolve API keys and model
|
|
8
|
+
* overrides without leaking secrets.
|
|
7
9
|
*/
|
|
8
10
|
import fs from 'node:fs';
|
|
9
11
|
import os from 'node:os';
|
|
10
12
|
import path from 'node:path';
|
|
13
|
+
import { configDir } from './config/xdg.mjs';
|
|
11
14
|
import { API_KEY_CREDENTIALS } from './providers/credential-catalog.mjs';
|
|
12
15
|
import { extractOpRef } from './providers/secret-resolver.mjs';
|
|
13
16
|
|
|
@@ -26,7 +29,7 @@ export function parseEnvFile(filePath) {
|
|
|
26
29
|
}
|
|
27
30
|
|
|
28
31
|
export function getUserConfigDir(homeDir = os.homedir()) {
|
|
29
|
-
return
|
|
32
|
+
return configDir(homeDir);
|
|
30
33
|
}
|
|
31
34
|
|
|
32
35
|
export function getUserEnvPath(homeDir = os.homedir()) {
|
|
@@ -109,31 +112,50 @@ function preferInjectedCredential(envValue, fileValue) {
|
|
|
109
112
|
export function loadConstructEnv({ rootDir, homeDir = os.homedir(), env = process.env, warn = true } = {}) {
|
|
110
113
|
const rootEnv = rootDir ? parseEnvFile(path.join(rootDir, '.env')) : {};
|
|
111
114
|
const userEnv = parseEnvFile(getUserEnvPath(homeDir));
|
|
112
|
-
|
|
115
|
+
|
|
116
|
+
// Most-specific config wins: project .env overrides user config.env, which
|
|
117
|
+
// overrides shell exports. A repo's local .env is closer to the work than a
|
|
118
|
+
// machine-wide default, so it takes the file-tier precedence.
|
|
119
|
+
const fileEnv = { ...userEnv, ...rootEnv };
|
|
120
|
+
const userEnvPath = getUserEnvPath(homeDir);
|
|
113
121
|
|
|
114
122
|
if (warn) {
|
|
123
|
+
// Every key that both files define to a different value is a real shadow:
|
|
124
|
+
// project .env silently wins, so surface it rather than gating on a
|
|
125
|
+
// hardcoded credential subset.
|
|
126
|
+
for (const key of Object.keys(rootEnv)) {
|
|
127
|
+
if (!(key in userEnv)) continue;
|
|
128
|
+
if (rootEnv[key] === userEnv[key]) continue;
|
|
129
|
+
if (preferInjectedCredential(rootEnv[key], userEnv[key])) continue;
|
|
130
|
+
process.stderr.write(
|
|
131
|
+
`[construct] WARNING: ${key} is set in both project .env (${rootEnv[key].slice(0, 6)}…) ` +
|
|
132
|
+
`and ${userEnvPath} (${userEnv[key].slice(0, 6)}…). ` +
|
|
133
|
+
`Project .env wins. To silence: remove the key from one file.\n`,
|
|
134
|
+
);
|
|
135
|
+
}
|
|
136
|
+
|
|
115
137
|
for (const key of Object.keys(env)) {
|
|
116
138
|
if (ENV_SHADOW_IGNORE.has(key)) continue;
|
|
117
139
|
if (!ENV_SHADOW_WARN.has(key)) continue;
|
|
118
140
|
// Only warn when process.env has a non-empty competing value.
|
|
119
141
|
// An empty-string env var (e.g. Claude for Desktop clears ANTHROPIC_API_KEY
|
|
120
|
-
// so its internal auth is used instead) is not a real conflict —
|
|
121
|
-
// silently and no user action is needed.
|
|
142
|
+
// so its internal auth is used instead) is not a real conflict — the file
|
|
143
|
+
// value wins silently and no user action is needed.
|
|
122
144
|
if (!env[key]) continue;
|
|
123
145
|
if (key in fileEnv && fileEnv[key] !== env[key]) {
|
|
124
146
|
if (preferInjectedCredential(env[key], fileEnv[key])) continue;
|
|
125
147
|
process.stderr.write(
|
|
126
148
|
`[construct] WARNING: process.env.${key} (${env[key].slice(0, 6)}…) ` +
|
|
127
|
-
`differs from config
|
|
128
|
-
`config
|
|
129
|
-
`update
|
|
149
|
+
`differs from the config file value (${fileEnv[key].slice(0, 6)}…). ` +
|
|
150
|
+
`The config file will be used. To silence: unset the shell variable or ` +
|
|
151
|
+
`update the config file to match.\n`,
|
|
130
152
|
);
|
|
131
153
|
}
|
|
132
154
|
}
|
|
133
155
|
}
|
|
134
156
|
|
|
135
|
-
// process.env is the base;
|
|
136
|
-
//
|
|
157
|
+
// process.env is the base; .env-file values override shell values so that
|
|
158
|
+
// credentials set in the dashboard always win over stale shell exports.
|
|
137
159
|
// Materialized credentials from `op run` (or an explicit export) win over stored
|
|
138
160
|
// op:// references so one 1Password auth per invocation is enough.
|
|
139
161
|
const merged = { ...env, ...fileEnv };
|
package/lib/features.mjs
CHANGED
|
@@ -9,13 +9,14 @@ import { readFileSync, existsSync, readdirSync } from 'fs';
|
|
|
9
9
|
import { homedir } from 'os';
|
|
10
10
|
import { join } from 'path';
|
|
11
11
|
import { loadPluginRegistry } from './plugin-registry.mjs';
|
|
12
|
+
import { configDir } from './config/xdg.mjs';
|
|
12
13
|
|
|
13
14
|
function getHomeDir(overrides = {}) {
|
|
14
15
|
return overrides.homeDir ?? homedir();
|
|
15
16
|
}
|
|
16
17
|
|
|
17
18
|
function getFeaturesFile(overrides = {}) {
|
|
18
|
-
return overrides.featuresFile ?? join(getHomeDir(overrides), '
|
|
19
|
+
return overrides.featuresFile ?? join(configDir(getHomeDir(overrides)), 'features.json');
|
|
19
20
|
}
|
|
20
21
|
|
|
21
22
|
function getClaudeSettingsPath(overrides = {}) {
|
|
@@ -145,10 +146,10 @@ function getProjectMcpPaths(overrides = {}) {
|
|
|
145
146
|
* Load Claude.ai server-side managed MCP IDs.
|
|
146
147
|
* These are integrations connected through Claude.ai's web interface
|
|
147
148
|
* (e.g., Notion, Google Drive) that aren't discoverable from local config.
|
|
148
|
-
* Users declare them via
|
|
149
|
+
* Users declare them via claude-ai-mcps.json in the XDG config dir: { "mcps": ["notion", "slack"] }
|
|
149
150
|
*/
|
|
150
151
|
function getClaudeAiManagedMcps(overrides = {}) {
|
|
151
|
-
const p = overrides.claudeAiMcpsPath ?? join(getHomeDir(overrides), '
|
|
152
|
+
const p = overrides.claudeAiMcpsPath ?? join(configDir(getHomeDir(overrides)), 'claude-ai-mcps.json');
|
|
152
153
|
if (!existsSync(p)) return [];
|
|
153
154
|
try {
|
|
154
155
|
const data = JSON.parse(readFileSync(p, 'utf8'));
|
package/lib/health-check.mjs
CHANGED
|
@@ -11,6 +11,7 @@ import os from 'node:os';
|
|
|
11
11
|
import path from 'node:path';
|
|
12
12
|
import { existsSync, readFileSync } from 'node:fs';
|
|
13
13
|
import { extractOpRef, hasAnySecret, hasSecret } from './providers/secret-resolver.mjs';
|
|
14
|
+
import { configDir } from './config/xdg.mjs';
|
|
14
15
|
|
|
15
16
|
const isWindows = os.platform() === 'win32';
|
|
16
17
|
|
|
@@ -110,8 +111,8 @@ export async function checkPrerequisites(options = {}) {
|
|
|
110
111
|
});
|
|
111
112
|
|
|
112
113
|
// Check user config
|
|
113
|
-
const hasUserConfig = existsSync(path.join(homeDir || os.homedir(), '
|
|
114
|
-
existsSync(
|
|
114
|
+
const hasUserConfig = existsSync(path.join(configDir(homeDir || os.homedir()), 'config.env')) ||
|
|
115
|
+
existsSync(configDir(homeDir || os.homedir()));
|
|
115
116
|
checks.push({
|
|
116
117
|
name: 'User config',
|
|
117
118
|
required: false,
|
|
@@ -176,7 +177,7 @@ function readCredentialRaw(varName, homeDir) {
|
|
|
176
177
|
for (const envPath of [
|
|
177
178
|
path.join(process.cwd(), '.env'),
|
|
178
179
|
path.join(homeDir, '.env'),
|
|
179
|
-
path.join(homeDir, '
|
|
180
|
+
path.join(configDir(homeDir), 'config.env'),
|
|
180
181
|
]) {
|
|
181
182
|
if (!existsSync(envPath)) continue;
|
|
182
183
|
try {
|
|
@@ -222,7 +223,7 @@ export function describeCredentialPresence(varName, { homeDir = os.homedir(), cw
|
|
|
222
223
|
for (const envPath of [
|
|
223
224
|
path.join(cwd, '.env'),
|
|
224
225
|
path.join(homeDir, '.env'),
|
|
225
|
-
path.join(homeDir, '
|
|
226
|
+
path.join(configDir(homeDir), 'config.env'),
|
|
226
227
|
]) {
|
|
227
228
|
if (!existsSync(envPath)) continue;
|
|
228
229
|
try {
|
|
@@ -295,7 +296,7 @@ const CREDENTIAL_VARS = [
|
|
|
295
296
|
];
|
|
296
297
|
|
|
297
298
|
/**
|
|
298
|
-
* Link discovered credential references into
|
|
299
|
+
* Link discovered credential references into the XDG config dir config.env without
|
|
299
300
|
* invoking `op read`. Plain values and op:// refs are persisted as found.
|
|
300
301
|
* @param {Object} options
|
|
301
302
|
* @param {string} options.homeDir
|
|
@@ -342,7 +343,7 @@ export function detectCredentials(options = {}) {
|
|
|
342
343
|
// GitHub Copilot: a device-flow credential (Construct's own store or the shared
|
|
343
344
|
// github-copilot store) is the usable signal; the VS Code extension and the
|
|
344
345
|
// copilot CLI are softer fallbacks.
|
|
345
|
-
const copilotAuthStore = existsSync(path.join(homeDir, '
|
|
346
|
+
const copilotAuthStore = existsSync(path.join(configDir(homeDir), 'auth', 'github-copilot.json')) ||
|
|
346
347
|
existsSync(path.join(homeDir, '.config', 'github-copilot', 'apps.json')) ||
|
|
347
348
|
existsSync(path.join(homeDir, '.config', 'github-copilot', 'hosts.json'));
|
|
348
349
|
const copilotDir = path.join(homeDir, '.vscode', 'extensions');
|
package/lib/hook-health.mjs
CHANGED
|
@@ -15,8 +15,9 @@ import fs from 'node:fs';
|
|
|
15
15
|
import path from 'node:path';
|
|
16
16
|
import { spawnSync } from 'node:child_process';
|
|
17
17
|
import { homedir } from 'node:os';
|
|
18
|
+
import { configDir, doctorRoot } from './config/xdg.mjs';
|
|
18
19
|
|
|
19
|
-
const CX_DIR =
|
|
20
|
+
const CX_DIR = doctorRoot();
|
|
20
21
|
const HOOK_HEALTH_DIR = path.join(CX_DIR, 'hook-health');
|
|
21
22
|
const HEALTH_CHECK_INTERVAL_MS = 60 * 1000; // 1 minute
|
|
22
23
|
|
|
@@ -266,12 +267,12 @@ async function checkSingleHook(hookId, config, hookPath) {
|
|
|
266
267
|
}
|
|
267
268
|
|
|
268
269
|
function findHookPath(hookName) {
|
|
269
|
-
//
|
|
270
|
+
// The user hook symlink lives in the XDG config dir; the project-local
|
|
271
|
+
// .construct/lib and the npm-global install are fallbacks.
|
|
270
272
|
const possiblePaths = [
|
|
271
|
-
path.join(
|
|
273
|
+
path.join(configDir(), 'lib', 'hooks', `${hookName}.mjs`),
|
|
272
274
|
path.join(process.cwd(), '.construct', 'lib', 'hooks', `${hookName}.mjs`),
|
|
273
275
|
path.join(homedir(), '.npm-global', 'lib', 'node_modules', '@geraldmaron/construct', 'lib', 'hooks', `${hookName}.mjs`),
|
|
274
|
-
// Try to find from PATH
|
|
275
276
|
];
|
|
276
277
|
|
|
277
278
|
for (const p of possiblePaths) {
|
package/lib/hooks/_lib/log.mjs
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* a regression in the hook harness or a malformed payload does not block the
|
|
6
6
|
* user. The trade-off is silent failure: until now, hook regressions were
|
|
7
7
|
* invisible. This helper writes a single JSONL entry per failure to
|
|
8
|
-
*
|
|
8
|
+
* <doctorRoot>/hook-failures.jsonl so `construct doctor` can surface the top
|
|
9
9
|
* failing hooks without changing the fail-open behavior of any individual
|
|
10
10
|
* hook.
|
|
11
11
|
*
|
|
@@ -21,9 +21,10 @@
|
|
|
21
21
|
|
|
22
22
|
import { appendFileSync, statSync, renameSync, mkdirSync } from 'node:fs';
|
|
23
23
|
import { join } from 'node:path';
|
|
24
|
-
import { homedir } from 'node:os';
|
|
25
24
|
|
|
26
|
-
|
|
25
|
+
import { doctorRoot } from '../../config/xdg.mjs';
|
|
26
|
+
|
|
27
|
+
const LOG_DIR = doctorRoot();
|
|
27
28
|
const LOG_PATH = join(LOG_DIR, 'hook-failures.jsonl');
|
|
28
29
|
const LOG_ROTATED_PATH = join(LOG_DIR, 'hook-failures.1.jsonl');
|
|
29
30
|
const LOG_MAX_BYTES = 1_048_576; // 1 MiB
|
|
@@ -29,6 +29,7 @@ import { homedir } from 'node:os';
|
|
|
29
29
|
|
|
30
30
|
import { resolveSetting, loadProjectConfig } from '../../config/project-config.mjs';
|
|
31
31
|
import { HOOK_OUTPUT_MODES } from '../../config/schema.mjs';
|
|
32
|
+
import { doctorRoot } from '../../config/xdg.mjs';
|
|
32
33
|
|
|
33
34
|
export { HOOK_OUTPUT_MODES };
|
|
34
35
|
|
|
@@ -93,7 +94,7 @@ export function writeHookContext({ payload, mode, homeDir = homedir(), stdout =
|
|
|
93
94
|
if (mode === 'stdout') { stdout.write(payload); return 'stdout'; }
|
|
94
95
|
if (mode === 'stderr') { stderr.write(payload); return 'stderr'; }
|
|
95
96
|
try {
|
|
96
|
-
const dir =
|
|
97
|
+
const dir = doctorRoot(homeDir);
|
|
97
98
|
if (!existsSync(dir)) mkdirSync(dir, { recursive: true });
|
|
98
99
|
writeFileSync(join(dir, 'session-start-last.log'), payload);
|
|
99
100
|
} catch { /* best effort — never block the session on a debug-log write */ }
|
|
@@ -24,10 +24,10 @@
|
|
|
24
24
|
*/
|
|
25
25
|
import { readFileSync, writeFileSync, mkdirSync } from 'node:fs';
|
|
26
26
|
import { join } from 'node:path';
|
|
27
|
-
import { homedir } from 'node:os';
|
|
28
27
|
import { appendBounded } from '../logging/rotate.mjs';
|
|
29
28
|
import { resolveProjectScopedPath } from '../project-root.mjs';
|
|
30
29
|
import { emit as emitRoleEvent } from '../roles/event-bus.mjs';
|
|
30
|
+
import { doctorRoot } from '../config/xdg.mjs';
|
|
31
31
|
import { logHookFailure } from './_lib/log.mjs';
|
|
32
32
|
|
|
33
33
|
let input = {};
|
|
@@ -74,8 +74,7 @@ if (errorIndicators.some(ind => lowerResult.includes(ind))) {
|
|
|
74
74
|
|
|
75
75
|
// Record agent invocation
|
|
76
76
|
try {
|
|
77
|
-
const
|
|
78
|
-
const cxDir = join(home, '.cx');
|
|
77
|
+
const cxDir = doctorRoot();
|
|
79
78
|
mkdirSync(cxDir, { recursive: true });
|
|
80
79
|
|
|
81
80
|
// Update last-agent files for coordination (shared + per-agent)
|
|
@@ -188,7 +187,7 @@ try {
|
|
|
188
187
|
// role-pending stays at user scope (a handoff might span projects),
|
|
189
188
|
// but each entry gets a projectId tag so a reader can attribute it.
|
|
190
189
|
|
|
191
|
-
const pendingPath = join(
|
|
190
|
+
const pendingPath = join(doctorRoot(), 'role-pending.jsonl');
|
|
192
191
|
const { resolveProjectScope } = await import('../project-root.mjs');
|
|
193
192
|
const scope = resolveProjectScope();
|
|
194
193
|
const bdMatch = /\b(construct-[a-z0-9]+)\b/i.exec(resultText) || [];
|
|
@@ -33,13 +33,13 @@
|
|
|
33
33
|
import { readFileSync, writeFileSync, existsSync, mkdirSync } from 'node:fs';
|
|
34
34
|
import { createHash } from 'node:crypto';
|
|
35
35
|
import { join, resolve, dirname } from 'node:path';
|
|
36
|
-
import { homedir } from 'node:os';
|
|
37
36
|
import { logHookFailure } from './_lib/log.mjs';
|
|
38
37
|
import { appendBounded, readLastLineAcrossSegments } from '../logging/rotate.mjs';
|
|
39
38
|
import { resolveProjectScopedPath } from '../project-root.mjs';
|
|
40
39
|
import { flushReadTrackerDeltas, recordReadDelta } from '../read-tracker-store.mjs';
|
|
40
|
+
import { doctorRoot } from '../config/xdg.mjs';
|
|
41
41
|
|
|
42
|
-
const CX_DIR =
|
|
42
|
+
const CX_DIR = doctorRoot();
|
|
43
43
|
// audit-reads.jsonl is PROJECT-SCOPED — reads happen in a specific project,
|
|
44
44
|
// not across the user's whole machine. resolveProjectScopedPath returns
|
|
45
45
|
// <project>/.cx/audit-reads.jsonl when the hook fires from inside a
|
|
@@ -36,12 +36,12 @@
|
|
|
36
36
|
import { readFileSync, existsSync } from 'node:fs';
|
|
37
37
|
import { createHash } from 'node:crypto';
|
|
38
38
|
import { join, resolve } from 'node:path';
|
|
39
|
-
import { homedir } from 'node:os';
|
|
40
39
|
import { appendAuditRecord } from '../audit-trail.mjs';
|
|
41
40
|
import { resolveProjectScopedPath } from '../project-root.mjs';
|
|
42
41
|
import { logHookFailure } from './_lib/log.mjs';
|
|
42
|
+
import { doctorRoot } from '../config/xdg.mjs';
|
|
43
43
|
|
|
44
|
-
const CX_DIR =
|
|
44
|
+
const CX_DIR = doctorRoot();
|
|
45
45
|
const AUDIT_FILE = resolveProjectScopedPath('audit-trail.jsonl', { ensureDir: false });
|
|
46
46
|
const LAST_AGENT = join(CX_DIR, 'last-agent.json');
|
|
47
47
|
const MUTATING_TOOLS = new Set(['Edit', 'Write', 'MultiEdit', 'NotebookEdit', 'Bash']);
|
|
@@ -21,12 +21,12 @@
|
|
|
21
21
|
*/
|
|
22
22
|
import { readFileSync, writeFileSync, mkdirSync } from 'node:fs';
|
|
23
23
|
import { join } from 'node:path';
|
|
24
|
-
import { homedir } from 'node:os';
|
|
25
24
|
import { appendBounded } from '../logging/rotate.mjs';
|
|
25
|
+
import { doctorRoot } from '../config/xdg.mjs';
|
|
26
26
|
|
|
27
27
|
const SIZE_THRESHOLD_CHARS = 4000;
|
|
28
|
-
const LOG_DIR = join(
|
|
29
|
-
const WARN_FLAGS = join(
|
|
28
|
+
const LOG_DIR = join(doctorRoot(), 'bash-logs');
|
|
29
|
+
const WARN_FLAGS = join(doctorRoot(), 'warn-flags.txt');
|
|
30
30
|
|
|
31
31
|
let input = {};
|
|
32
32
|
try { input = JSON.parse(readFileSync(0, 'utf8')); } catch { process.exit(0); }
|
|
@@ -33,6 +33,6 @@ if (!result.violations.length) process.exit(0);
|
|
|
33
33
|
const output = formatBrandViolations([result]);
|
|
34
34
|
process.stderr.write(`${output}\n`);
|
|
35
35
|
process.stderr.write(
|
|
36
|
-
'\nBrand policy blocked this edit (marketing voice, retired fonts, or Construct/cli naming). See docs/reference/branding.md and docs/STYLE.md.\n',
|
|
36
|
+
'\nBrand policy blocked this edit (marketing voice, retired fonts, or Construct/cli naming). See docs/guides/reference/branding.md and docs/STYLE.md.\n',
|
|
37
37
|
);
|
|
38
38
|
process.exit(2);
|
|
@@ -27,11 +27,12 @@
|
|
|
27
27
|
|
|
28
28
|
import { readFileSync, writeFileSync, existsSync, mkdirSync } from 'node:fs';
|
|
29
29
|
import { execSync, spawn } from 'node:child_process';
|
|
30
|
-
import { homedir } from 'node:os';
|
|
31
30
|
import { join, dirname, resolve } from 'node:path';
|
|
32
31
|
import { fileURLToPath } from 'node:url';
|
|
33
32
|
|
|
34
|
-
|
|
33
|
+
import { doctorRoot } from '../config/xdg.mjs';
|
|
34
|
+
|
|
35
|
+
const CACHE_PATH = join(doctorRoot(), 'ci-status-cache.json');
|
|
35
36
|
const CACHE_TTL_MS = 60_000;
|
|
36
37
|
const HERE = dirname(fileURLToPath(import.meta.url));
|
|
37
38
|
const REFRESHER = resolve(HERE, '..', '..', 'scripts', 'refresh-ci-status.mjs');
|
|
@@ -33,10 +33,10 @@
|
|
|
33
33
|
*/
|
|
34
34
|
import { readFileSync, writeFileSync, existsSync, mkdirSync } from 'node:fs';
|
|
35
35
|
import { join } from 'node:path';
|
|
36
|
-
import { homedir } from 'node:os';
|
|
37
36
|
import { resolveContextWindow } from '../telemetry/model-pricing-catalog.mjs';
|
|
37
|
+
import { doctorRoot } from '../config/xdg.mjs';
|
|
38
38
|
|
|
39
|
-
const CX_DIR =
|
|
39
|
+
const CX_DIR = doctorRoot();
|
|
40
40
|
const COST_LOG = join(CX_DIR, 'session-cost.jsonl');
|
|
41
41
|
const EFFICIENCY = join(CX_DIR, 'session-efficiency.json');
|
|
42
42
|
const STATE = join(CX_DIR, 'context-watch-state.json');
|