oxe-cc 1.22.0 → 1.22.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/.cursor/commands/oxe-discuss.md +45 -45
- package/.cursor/commands/oxe-execute.md +52 -52
- package/.cursor/commands/oxe-help.md +44 -44
- package/.cursor/commands/oxe-next.md +44 -44
- package/.cursor/commands/oxe-plan.md +49 -49
- package/.cursor/commands/oxe-quick.md +49 -49
- package/.cursor/commands/oxe-review-pr.md +47 -47
- package/.cursor/commands/oxe-scan.md +47 -47
- package/.cursor/commands/oxe-ship.md +47 -47
- package/.cursor/commands/oxe-spec.md +49 -49
- package/.cursor/commands/oxe-verify.md +50 -50
- package/.cursor/commands/oxe.md +51 -51
- package/.github/prompts/oxe-alm.prompt.md +47 -47
- package/.github/prompts/oxe-ask.prompt.md +47 -47
- package/.github/prompts/oxe-capabilities.prompt.md +47 -47
- package/.github/prompts/oxe-checkpoint.prompt.md +47 -47
- package/.github/prompts/oxe-compact.prompt.md +46 -46
- package/.github/prompts/oxe-dashboard.prompt.md +47 -47
- package/.github/prompts/oxe-debug.prompt.md +47 -47
- package/.github/prompts/oxe-discuss.prompt.md +47 -47
- package/.github/prompts/oxe-execute.prompt.md +52 -52
- package/.github/prompts/oxe-forensics.prompt.md +47 -47
- package/.github/prompts/oxe-help.prompt.md +46 -46
- package/.github/prompts/oxe-loop.prompt.md +47 -47
- package/.github/prompts/oxe-milestone.prompt.md +47 -47
- package/.github/prompts/oxe-next.prompt.md +46 -46
- package/.github/prompts/oxe-obs.prompt.md +47 -47
- package/.github/prompts/oxe-plan-agent.prompt.md +46 -46
- package/.github/prompts/oxe-plan.prompt.md +49 -49
- package/.github/prompts/oxe-project.prompt.md +47 -47
- package/.github/prompts/oxe-quick.prompt.md +49 -49
- package/.github/prompts/oxe-research.prompt.md +47 -47
- package/.github/prompts/oxe-retro.prompt.md +47 -47
- package/.github/prompts/oxe-review-pr.prompt.md +47 -47
- package/.github/prompts/oxe-route.prompt.md +47 -47
- package/.github/prompts/oxe-scan.prompt.md +47 -47
- package/.github/prompts/oxe-security.prompt.md +47 -47
- package/.github/prompts/oxe-session.prompt.md +47 -47
- package/.github/prompts/oxe-ship.prompt.md +47 -47
- package/.github/prompts/oxe-skill.prompt.md +47 -47
- package/.github/prompts/oxe-spec.prompt.md +49 -49
- package/.github/prompts/oxe-ui-review.prompt.md +47 -47
- package/.github/prompts/oxe-ui-spec.prompt.md +47 -47
- package/.github/prompts/oxe-update.prompt.md +46 -46
- package/.github/prompts/oxe-validate-gaps.prompt.md +47 -47
- package/.github/prompts/oxe-verify.prompt.md +50 -50
- package/.github/prompts/oxe-workstream.prompt.md +47 -47
- package/.github/prompts/oxe.prompt.md +51 -51
- package/.github/workflows/release.yml +31 -0
- package/CHANGELOG.md +88 -0
- package/README.md +1 -1
- package/bin/lib/commands/ops-commands.cjs +751 -0
- package/bin/lib/commands/spec-program-commands.cjs +337 -0
- package/bin/lib/operational/alm-refine-runtime.cjs +791 -0
- package/bin/lib/operational/child-env.cjs +52 -0
- package/bin/lib/operational/promote-runtime.cjs +1187 -0
- package/bin/lib/oxe-agent-coord.cjs +246 -0
- package/bin/lib/oxe-alm-refine.cjs +97 -1
- package/bin/lib/oxe-ci-adapter.cjs +304 -0
- package/bin/lib/oxe-complexity.cjs +1 -1
- package/bin/lib/oxe-decisions.cjs +9 -3
- package/bin/lib/oxe-dir-info.cjs +20 -1
- package/bin/lib/oxe-env-sanitize.cjs +6 -1
- package/bin/lib/oxe-git-root.cjs +97 -0
- package/bin/lib/oxe-grill.cjs +90 -1
- package/bin/lib/oxe-onboard.cjs +640 -0
- package/bin/lib/oxe-operational.cjs +14481 -15949
- package/bin/lib/oxe-origin.cjs +4 -1
- package/bin/lib/oxe-phase-gates.cjs +139 -2
- package/bin/lib/oxe-plan-build.cjs +62 -2
- package/bin/lib/oxe-plan-mutate.cjs +108 -2
- package/bin/lib/oxe-preflight.cjs +9 -3
- package/bin/lib/oxe-presets.cjs +216 -0
- package/bin/lib/oxe-project-env.cjs +79 -0
- package/bin/lib/oxe-project-health.cjs +2 -0
- package/bin/lib/oxe-reevaluate.cjs +198 -0
- package/bin/lib/oxe-release-ops.cjs +51 -15
- package/bin/lib/oxe-scorecard.cjs +394 -1
- package/bin/lib/oxe-ship-pr.cjs +72 -4
- package/bin/lib/oxe-spec-check.cjs +32 -0
- package/bin/lib/oxe-suite-impact.cjs +1160 -1145
- package/bin/lib/oxe-sync.cjs +99 -2
- package/bin/lib/oxe-verify-cache.cjs +132 -0
- package/bin/lib/oxe-vitest-batch.cjs +10 -3
- package/bin/lib/oxe-worktree-gc.cjs +655 -170
- package/bin/oxe-cc.js +10042 -10669
- package/commands/oxe/alm.md +54 -54
- package/commands/oxe/ask.md +55 -55
- package/commands/oxe/capabilities.md +50 -50
- package/commands/oxe/checkpoint.md +53 -53
- package/commands/oxe/compact.md +47 -47
- package/commands/oxe/dashboard.md +51 -51
- package/commands/oxe/debug.md +58 -58
- package/commands/oxe/discuss.md +58 -58
- package/commands/oxe/execute.md +63 -63
- package/commands/oxe/forensics.md +53 -53
- package/commands/oxe/help.md +48 -48
- package/commands/oxe/loop.md +54 -54
- package/commands/oxe/milestone.md +53 -53
- package/commands/oxe/next.md +49 -49
- package/commands/oxe/obs.md +53 -53
- package/commands/oxe/oxe.md +55 -55
- package/commands/oxe/plan-agent.md +57 -57
- package/commands/oxe/plan.md +59 -59
- package/commands/oxe/project.md +53 -53
- package/commands/oxe/quick.md +53 -53
- package/commands/oxe/research.md +53 -53
- package/commands/oxe/retro.md +53 -53
- package/commands/oxe/review-pr.md +53 -53
- package/commands/oxe/route.md +48 -48
- package/commands/oxe/scan.md +58 -58
- package/commands/oxe/security.md +53 -53
- package/commands/oxe/session.md +53 -53
- package/commands/oxe/ship.md +53 -53
- package/commands/oxe/skill.md +53 -53
- package/commands/oxe/spec.md +59 -59
- package/commands/oxe/ui-review.md +53 -53
- package/commands/oxe/ui-spec.md +53 -53
- package/commands/oxe/update.md +53 -53
- package/commands/oxe/validate-gaps.md +53 -53
- package/commands/oxe/verify-audit.md +50 -50
- package/commands/oxe/verify.md +60 -60
- package/commands/oxe/workflow-authoring.md +50 -50
- package/commands/oxe/workstream.md +53 -53
- package/docs/RELEASE-READINESS.md +7 -1
- package/docs/adr/D-1-isolamento-read-only-e-sanitizacao-centralizada-de-env-vars.md +29 -29
- package/docs/adr/D-2-junction-segura-de-node-modules-condicionada-a-sha-256-de-pa.md +29 -29
- package/docs/adr/D-3-preflight-local-5s-impacto-estatico-e2e-e-leitura-explicita.md +29 -29
- package/docs/adr/D-4-governanca-de-release-unificada-retomada-idempotente-pos-rei.md +29 -29
- package/docs/adr/D-5-core-agnostico-vs-presets-declarativos-de-dominio.md +29 -0
- package/docs/adr/D-6-decomposicao-strangler-fig-de-oxe-cc-e-oxe-operational.md +29 -0
- package/docs/adr/D-7-paridade-pre-push-com-phase-gates-path-aware-json-compacto-e.md +28 -0
- package/docs/adr/D-F1F4-1-paridade-pre-push-compactacao-json-sync-version-pins-e-quali.md +44 -0
- package/docs/adr/README.md +18 -14
- package/lib/runtime/verification/verification-compiler.d.ts +12 -1
- package/lib/runtime/verification/verification-compiler.js +235 -65
- package/oxe/templates/CONFIG.md +14 -1
- package/oxe/workflows/help.md +3 -0
- package/oxe/workflows/lean/execute.md +2 -1
- package/oxe/workflows/ship.md +4 -2
- package/package.json +4 -4
- package/packages/runtime/package.json +1 -1
- package/packages/runtime/src/verification/verification-compiler.ts +193 -25
- package/packages/runtime/tsconfig.json +1 -0
- package/vscode-extension/package.json +1 -1
|
@@ -28,10 +28,14 @@ function list(programDir) {
|
|
|
28
28
|
return [...byId.values()];
|
|
29
29
|
}
|
|
30
30
|
|
|
31
|
-
function nextId(existing, phase) {
|
|
31
|
+
function nextId(existing, phase, extraIds = []) {
|
|
32
32
|
const p = phase ? String(phase).toUpperCase().replace(/[^A-Z0-9.]/g, '') : '';
|
|
33
33
|
const re = p ? new RegExp(`^D-${p.replace(/\./g, '\\.')}-(\\d+)$`) : /^D-(\d+)$/;
|
|
34
|
-
const
|
|
34
|
+
const allIds = [
|
|
35
|
+
...(Array.isArray(existing) ? existing.map((d) => String(d && d.id ? d.id : '')) : []),
|
|
36
|
+
...(Array.isArray(extraIds) ? extraIds.map((id) => String(id || '')) : []),
|
|
37
|
+
];
|
|
38
|
+
const max = allIds.reduce((m, id) => { const hit = re.exec(id); return hit ? Math.max(m, Number(hit[1])) : m; }, 0);
|
|
35
39
|
return p ? `D-${p}-${max + 1}` : `D-${max + 1}`;
|
|
36
40
|
}
|
|
37
41
|
|
|
@@ -94,9 +98,11 @@ function add(programDir, input = {}) {
|
|
|
94
98
|
if (!old) throw new Error(`--supersedes ${supersedes}: decisão inexistente (oxe-cc decision list)`);
|
|
95
99
|
if (old.status && old.status !== 'active') throw new Error(`--supersedes ${supersedes}: a decisão já está ${old.status}`);
|
|
96
100
|
}
|
|
101
|
+
const knownIds = Array.isArray(input.knownIds) ? input.knownIds.map(String) : [];
|
|
102
|
+
const existingIdSet = new Set([...existing.map((d) => d.id), ...knownIds]);
|
|
97
103
|
const record = {
|
|
98
104
|
kind: 'decision',
|
|
99
|
-
id: input.id && DECISION_ID_RE.test(String(input.id)) && !
|
|
105
|
+
id: input.id && DECISION_ID_RE.test(String(input.id)) && !existingIdSet.has(String(input.id)) ? String(input.id) : nextId(existing, input.phase, knownIds),
|
|
100
106
|
title,
|
|
101
107
|
text: String(input.text || '').trim() || null,
|
|
102
108
|
phase: input.phase || null,
|
package/bin/lib/oxe-dir-info.cjs
CHANGED
|
@@ -132,7 +132,26 @@ function worktreesOxe(projectRoot, options = {}) {
|
|
|
132
132
|
else if (cur && line.startsWith('branch ')) cur.branch = line.slice(7).replace('refs/heads/', '').trim();
|
|
133
133
|
else if (cur && line === 'detached') cur.branch = '(detached)';
|
|
134
134
|
}
|
|
135
|
-
|
|
135
|
+
let activeAgents = [];
|
|
136
|
+
try {
|
|
137
|
+
activeAgents = require('./oxe-agent-coord.cjs').listActiveAgents(projectRoot, { readOnly: true });
|
|
138
|
+
} catch { activeAgents = []; }
|
|
139
|
+
const norm = (p) => {
|
|
140
|
+
let r = path.resolve(String(p || ''));
|
|
141
|
+
try { r = fs.realpathSync(r); } catch { /* ignore */ }
|
|
142
|
+
const s = r.replace(/\\/g, '/').replace(/\/+$/, '');
|
|
143
|
+
return process.platform === 'win32' ? s.toLowerCase() : s;
|
|
144
|
+
};
|
|
145
|
+
return rows.map((r) => {
|
|
146
|
+
const wtNorm = norm(r.path);
|
|
147
|
+
const wtAgents = activeAgents.filter((a) => norm(a.worktree) === wtNorm);
|
|
148
|
+
return {
|
|
149
|
+
...r,
|
|
150
|
+
here: path.resolve(r.path) === path.resolve(projectRoot),
|
|
151
|
+
oxe: describeOxeDir(r.path, options),
|
|
152
|
+
active_agents: wtAgents,
|
|
153
|
+
};
|
|
154
|
+
});
|
|
136
155
|
}
|
|
137
156
|
|
|
138
157
|
module.exports = { MARKER, readMarker, touchMarker, describeOxeDir, oxeDirLine, worktreesOxe, runningVersion };
|
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
|
|
14
14
|
const fs = require('fs');
|
|
15
15
|
const path = require('path');
|
|
16
|
+
const presets = require('./oxe-presets.cjs');
|
|
16
17
|
|
|
17
18
|
const DEFAULT_STRIP_PREFIXES = Object.freeze(['OXESPACE_', 'AI_MEMORY_']);
|
|
18
19
|
const DEFAULT_STRIP_EXACT = Object.freeze(['NODE_TEST_CONTEXT']);
|
|
@@ -44,7 +45,11 @@ function resolveEnvSanitizeConfig(projectRootOrCfg) {
|
|
|
44
45
|
: (projectRootOrCfg && typeof projectRootOrCfg === 'object' ? projectRootOrCfg : {});
|
|
45
46
|
const es = cfg.envSanitize;
|
|
46
47
|
const enabled = es === false || (es && typeof es === 'object' && es.enabled === false) ? false : true;
|
|
47
|
-
const
|
|
48
|
+
const presetCfg = presets.resolvePresetConfig(cfg);
|
|
49
|
+
const basePrefixes = presetCfg.hasExplicitPreset
|
|
50
|
+
? (presetCfg.envSanitize && Array.isArray(presetCfg.envSanitize.stripEnvPrefixes) ? presetCfg.envSanitize.stripEnvPrefixes : [])
|
|
51
|
+
: DEFAULT_STRIP_PREFIXES;
|
|
52
|
+
const prefixSet = new Set(enabled ? basePrefixes : []);
|
|
48
53
|
const addPrefixes = (arr) => {
|
|
49
54
|
if (!Array.isArray(arr)) return;
|
|
50
55
|
for (const p of arr) {
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* 1.22.2 (OXB-222-14): Safe project git root resolver & $HOME/.git hazard detector.
|
|
5
|
+
* Prevents tools and tests running in non-git or temp directories under $HOME from silently
|
|
6
|
+
* inheriting an accidental/empty `.git` folder in the user's home directory.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
const fs = require('fs');
|
|
10
|
+
const os = require('os');
|
|
11
|
+
const path = require('path');
|
|
12
|
+
const { spawnSync } = require('child_process');
|
|
13
|
+
|
|
14
|
+
function normPath(p) {
|
|
15
|
+
let resolved = path.resolve(String(p || ''));
|
|
16
|
+
try {
|
|
17
|
+
resolved = fs.realpathSync(resolved);
|
|
18
|
+
} catch { /* keep path.resolve if missing */ }
|
|
19
|
+
const clean = resolved.replace(/\\/g, '/').replace(/\/+$/, '');
|
|
20
|
+
return process.platform === 'win32' ? clean.toLowerCase() : clean;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
function isPathInside(childNorm, parentNorm) {
|
|
24
|
+
if (!childNorm || !parentNorm) return false;
|
|
25
|
+
return childNorm === parentNorm || childNorm.startsWith(`${parentNorm}/`);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Resolves the git top-level directory owned by `projectRoot`, or returns `null` when
|
|
30
|
+
* `projectRoot` is not inside a real project git repo (rejecting inherited `$HOME/.git`
|
|
31
|
+
* or ancestor git dirs outside `os.tmpdir()` when `projectRoot` is inside `os.tmpdir()`).
|
|
32
|
+
*
|
|
33
|
+
* @param {string} projectRoot
|
|
34
|
+
* @param {{ spawn?: Function, homeDir?: string, tmpDir?: string }} [options]
|
|
35
|
+
* @returns {string | null}
|
|
36
|
+
*/
|
|
37
|
+
function resolveProjectGitRoot(projectRoot, options = {}) {
|
|
38
|
+
const spawn = options.spawn || spawnSync;
|
|
39
|
+
const rootAbs = path.resolve(String(projectRoot || process.cwd()));
|
|
40
|
+
if (!fs.existsSync(rootAbs)) return null;
|
|
41
|
+
|
|
42
|
+
let res;
|
|
43
|
+
try {
|
|
44
|
+
res = spawn('git', ['rev-parse', '--show-toplevel'], {
|
|
45
|
+
cwd: rootAbs,
|
|
46
|
+
encoding: 'utf8',
|
|
47
|
+
windowsHide: true,
|
|
48
|
+
});
|
|
49
|
+
} catch {
|
|
50
|
+
return null;
|
|
51
|
+
}
|
|
52
|
+
if (!res || res.status !== 0) return null;
|
|
53
|
+
const topRaw = String(res.stdout || '').trim();
|
|
54
|
+
if (!topRaw) return null;
|
|
55
|
+
|
|
56
|
+
const rootNorm = normPath(rootAbs);
|
|
57
|
+
const topNorm = normPath(topRaw);
|
|
58
|
+
if (topNorm !== rootNorm && !fs.existsSync(path.join(rootAbs, '.git'))) {
|
|
59
|
+
const homeNorm = normPath(options.homeDir || os.homedir());
|
|
60
|
+
const tmpNorm = normPath(options.tmpDir || os.tmpdir());
|
|
61
|
+
if (topNorm === homeNorm) return null;
|
|
62
|
+
if (isPathInside(rootNorm, tmpNorm) && !isPathInside(topNorm, tmpNorm)) return null;
|
|
63
|
+
}
|
|
64
|
+
return path.resolve(topRaw);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* Detects whether the user's home directory contains an accidental `.git` directory/file
|
|
69
|
+
* that could leak into non-git folders or temp directories under `$HOME`.
|
|
70
|
+
*
|
|
71
|
+
* @param {string} projectRoot
|
|
72
|
+
* @param {{ homeDir?: string }} [options]
|
|
73
|
+
* @returns {{ hazard: boolean, home_dir: string, home_git: string | null }}
|
|
74
|
+
*/
|
|
75
|
+
function detectHomeGitHazard(projectRoot, options = {}) {
|
|
76
|
+
const homeDir = path.resolve(options.homeDir || os.homedir());
|
|
77
|
+
const homeGit = path.join(homeDir, '.git');
|
|
78
|
+
const rootNorm = normPath(projectRoot || process.cwd());
|
|
79
|
+
const homeNorm = normPath(homeDir);
|
|
80
|
+
// If the project itself IS the home dir intentionally, do not warn as accidental hazard.
|
|
81
|
+
if (rootNorm === homeNorm) {
|
|
82
|
+
return { hazard: false, home_dir: homeDir, home_git: null };
|
|
83
|
+
}
|
|
84
|
+
const exists = fs.existsSync(homeGit);
|
|
85
|
+
return {
|
|
86
|
+
hazard: exists,
|
|
87
|
+
home_dir: homeDir,
|
|
88
|
+
home_git: exists ? homeGit : null,
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
module.exports = {
|
|
93
|
+
normPath,
|
|
94
|
+
isPathInside,
|
|
95
|
+
resolveProjectGitRoot,
|
|
96
|
+
detectHomeGitHazard,
|
|
97
|
+
};
|
package/bin/lib/oxe-grill.cjs
CHANGED
|
@@ -342,6 +342,95 @@ function close(dir, input = {}) {
|
|
|
342
342
|
return { closed: true, decisions: s.decisions.length, assumptions: s.assumptions.length, terms: s.terms.length };
|
|
343
343
|
}
|
|
344
344
|
|
|
345
|
+
/**
|
|
346
|
+
* OXB-222-05: Declarative batch import of a structured briefing JSON (facts, questions, optional answers, terms).
|
|
347
|
+
* Strictly preserves human playback rigor: NEVER emits `confirm` or `close` events regardless of payload fields.
|
|
348
|
+
*/
|
|
349
|
+
function importBriefing(dir, doc, options = {}) {
|
|
350
|
+
if (!doc || typeof doc !== 'object' || Array.isArray(doc)) {
|
|
351
|
+
throw new Error('grill import: briefing JSON deve ser um objeto { type?, title?, facts?, questions?, terms? }');
|
|
352
|
+
}
|
|
353
|
+
const started = start(dir, {
|
|
354
|
+
type: doc.type || options.type || 'feature',
|
|
355
|
+
title: doc.title || options.title || null,
|
|
356
|
+
restart: Boolean(options.restart),
|
|
357
|
+
});
|
|
358
|
+
let factsImported = 0;
|
|
359
|
+
let questionsImported = 0;
|
|
360
|
+
let answersImported = 0;
|
|
361
|
+
let termsImported = 0;
|
|
362
|
+
const defaultSource = options.source || 'briefing';
|
|
363
|
+
|
|
364
|
+
for (const rawFact of Array.isArray(doc.facts) ? doc.facts : []) {
|
|
365
|
+
if (!rawFact || typeof rawFact !== 'object') continue;
|
|
366
|
+
fact(dir, {
|
|
367
|
+
branch: rawFact.branch,
|
|
368
|
+
text: rawFact.text,
|
|
369
|
+
question: rawFact.question,
|
|
370
|
+
source: rawFact.source || defaultSource,
|
|
371
|
+
affects: rawFact.affects,
|
|
372
|
+
decision: Boolean(rawFact.decision),
|
|
373
|
+
stale: Boolean(rawFact.stale),
|
|
374
|
+
});
|
|
375
|
+
factsImported += 1;
|
|
376
|
+
}
|
|
377
|
+
|
|
378
|
+
for (const rawQ of Array.isArray(doc.questions) ? doc.questions : []) {
|
|
379
|
+
if (!rawQ || typeof rawQ !== 'object') continue;
|
|
380
|
+
const asked = ask(dir, {
|
|
381
|
+
branch: rawQ.branch,
|
|
382
|
+
question: rawQ.question,
|
|
383
|
+
options: rawQ.options,
|
|
384
|
+
recommended: rawQ.recommended,
|
|
385
|
+
why: rawQ.why,
|
|
386
|
+
affects: rawQ.affects,
|
|
387
|
+
depends: rawQ.depends,
|
|
388
|
+
decision: Boolean(rawQ.decision),
|
|
389
|
+
case: rawQ.case || rawQ.cases,
|
|
390
|
+
need: rawQ.need,
|
|
391
|
+
});
|
|
392
|
+
questionsImported += 1;
|
|
393
|
+
if (rawQ.answer != null && String(rawQ.answer).trim() !== '') {
|
|
394
|
+
const rawAns = String(rawQ.answer).trim();
|
|
395
|
+
const isChoice = /^(ok|sim|recomendad[ao]|rec|\d+|[a-z]\)?)$/i.test(rawAns);
|
|
396
|
+
answer(dir, asked.id, {
|
|
397
|
+
...(isChoice ? { choice: rawAns } : { text: rawAns }),
|
|
398
|
+
by: rawQ.by || options.by || 'import',
|
|
399
|
+
source: rawQ.answer_source || rawQ.source || defaultSource,
|
|
400
|
+
decision: rawQ.decision,
|
|
401
|
+
});
|
|
402
|
+
answersImported += 1;
|
|
403
|
+
}
|
|
404
|
+
}
|
|
405
|
+
|
|
406
|
+
for (const rawTerm of Array.isArray(doc.terms) ? doc.terms : []) {
|
|
407
|
+
if (!rawTerm || typeof rawTerm !== 'object') continue;
|
|
408
|
+
if (rawTerm.none) {
|
|
409
|
+
term(dir, { none: true });
|
|
410
|
+
} else {
|
|
411
|
+
term(dir, {
|
|
412
|
+
term: rawTerm.term,
|
|
413
|
+
definition: rawTerm.definition,
|
|
414
|
+
synonyms: rawTerm.synonyms,
|
|
415
|
+
source: rawTerm.source || defaultSource,
|
|
416
|
+
});
|
|
417
|
+
termsImported += 1;
|
|
418
|
+
}
|
|
419
|
+
}
|
|
420
|
+
|
|
421
|
+
const ignoredAutoConfirm = Boolean(doc.confirm || doc.confirmed || doc.close || doc.closed);
|
|
422
|
+
return {
|
|
423
|
+
imported: true,
|
|
424
|
+
type: started.type,
|
|
425
|
+
facts_imported: factsImported,
|
|
426
|
+
questions_imported: questionsImported,
|
|
427
|
+
answers_imported: answersImported,
|
|
428
|
+
terms_imported: termsImported,
|
|
429
|
+
unconfirmed: true,
|
|
430
|
+
...(ignoredAutoConfirm ? { ignored_auto_confirm: true } : {}),
|
|
431
|
+
};
|
|
432
|
+
}
|
|
433
|
+
|
|
345
434
|
// ── projections ──────────────────────────────────────────────────────────────────────────────────────────────────
|
|
346
435
|
|
|
347
436
|
const esc = (s) => String(s == null ? '' : s).replace(/\|/g, '\\|').replace(/\r?\n/g, ' ');
|
|
@@ -439,6 +528,6 @@ function rfcSuggestion(s, specText = '') {
|
|
|
439
528
|
}
|
|
440
529
|
|
|
441
530
|
module.exports = {
|
|
442
|
-
BRANCHES, BRANCH_IDS, BLOCKING_BY_TYPE, TYPES, dirFor, readRecords, replay, status, start, ask, answer, fact, mark, defer, confirm, term, conflict, resolve, close,
|
|
531
|
+
BRANCHES, BRANCH_IDS, BLOCKING_BY_TYPE, TYPES, dirFor, readRecords, replay, status, start, ask, answer, fact, mark, defer, confirm, term, conflict, resolve, close, importBriefing,
|
|
443
532
|
renderMarkdown, writeProjection, writeGlossary, readGlossary, dependents, rfcSuggestion,
|
|
444
533
|
};
|