ultra-builder-pro-cli 0.25.1 → 0.26.1
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/.ultra-template/changes/abandoned/.gitkeep +0 -0
- package/.ultra-template/contexts/TEMPLATE.md +94 -0
- package/.ultra-template/decisions/.gitkeep +1 -0
- package/.ultra-template/evidence/.gitkeep +1 -0
- package/.ultra-template/north-star.md +46 -0
- package/.ultra-template/research/.gitkeep +1 -0
- package/.ultra-template/specs/discovery.md +2 -2
- package/.ultra-template/tasks.json +3 -0
- package/.ultra-template/test-report.json +27 -0
- package/CHANGELOG.md +107 -1
- package/README.md +217 -579
- package/adapters/_shared/delegate-profiles/kimi-read-only.md +15 -0
- package/adapters/_shared/delegate-profiles/kimi-write.md +17 -0
- package/adapters/_shared/file-ops.cjs +76 -2
- package/adapters/_shared/host-profile.cjs +97 -0
- package/adapters/_shared/plugin-core.cjs +204 -0
- package/adapters/_shared/runtime-assets.cjs +31 -96
- package/adapters/claude.js +92 -291
- package/adapters/codex.js +309 -842
- package/adapters/grok.js +143 -1469
- package/adapters/kimi.js +124 -1053
- package/adapters/opencode.js +230 -742
- package/bin/delegate-worker.cjs +328 -0
- package/bin/delegate.cjs +463 -0
- package/bin/install.js +38 -11
- package/docs/ARCHITECTURE.md +125 -216
- package/docs/ARTIFACT-AUTHORITY.md +90 -268
- package/docs/DECISIONS.md +77 -87
- package/docs/PHILOSOPHY.md +208 -0
- package/docs/PLUGIN-ISOLATION-CONTRACT.md +65 -39
- package/docs/RUNTIME-COMPAT-MATRIX.md +140 -155
- package/docs/SKILL-AUTHORING.md +94 -73
- package/docs/WORKFLOW-LIFECYCLE.md +97 -189
- package/hooks/README.md +19 -37
- package/hooks/_common.py +113 -0
- package/hooks/adapters/codex.py +9 -16
- package/hooks/adapters/grok.py +5 -5
- package/hooks/adapters/kimi.py +8 -14
- package/hooks/block_dangerous_commands.py +201 -0
- package/hooks/compact_context.py +65 -0
- package/hooks/mid_workflow_recall.py +25 -0
- package/hooks/post_edit_guard.py +105 -0
- package/hooks/session_context.py +30 -0
- package/package.json +17 -52
- package/skills/ultra-change/SKILL.md +115 -50
- package/skills/ultra-change/references/change-contract.md +68 -3
- package/skills/ultra-delegate/SKILL.md +89 -0
- package/skills/ultra-delegate/references/delegation-contract.md +59 -0
- package/skills/ultra-delegate/scripts/delegate_wait.py +86 -0
- package/skills/ultra-deliver/SKILL.md +98 -42
- package/skills/ultra-deliver/references/baseline-reconciliation.md +39 -20
- package/skills/ultra-dev/SKILL.md +115 -62
- package/skills/ultra-dev/references/debugging.md +22 -0
- package/skills/ultra-domain-modeling/SKILL.md +79 -0
- package/skills/ultra-grilling/SKILL.md +118 -0
- package/skills/ultra-grilling/references/reframing.md +72 -0
- package/skills/ultra-init/SKILL.md +102 -37
- package/skills/ultra-init/references/brownfield-adoption.md +33 -83
- package/skills/ultra-init/scripts/init_project.cjs +84 -0
- package/skills/ultra-plan/SKILL.md +101 -68
- package/skills/ultra-research/SKILL.md +68 -48
- package/skills/ultra-research/references/00-problem-validation.md +5 -5
- package/skills/ultra-research/references/01-opportunity-discovery.md +3 -3
- package/skills/ultra-research/references/02-market-assessment.md +5 -4
- package/skills/ultra-research/references/03-competitive-landscape.md +3 -3
- package/skills/ultra-research/references/04-product-strategy.md +3 -3
- package/skills/ultra-research/references/05-assumptions-validation.md +5 -5
- package/skills/ultra-research/references/10-user-personas.md +3 -2
- package/skills/ultra-research/references/11-user-scenarios.md +3 -3
- package/skills/ultra-research/references/20-user-stories.md +4 -3
- package/skills/ultra-research/references/21-features-scope.md +3 -2
- package/skills/ultra-research/references/22-success-metrics.md +3 -3
- package/skills/ultra-research/references/30-architecture-context.md +3 -3
- package/skills/ultra-research/references/31-solution-strategy.md +3 -3
- package/skills/ultra-research/references/32-building-blocks.md +3 -3
- package/skills/ultra-research/references/40-deployment.md +3 -3
- package/skills/ultra-research/references/41-quality-risks.md +3 -3
- package/skills/ultra-research/references/99-synthesis.md +7 -7
- package/skills/ultra-review/SKILL.md +84 -32
- package/skills/ultra-review/references/code.md +17 -0
- package/skills/ultra-review/references/comments.md +12 -0
- package/skills/ultra-review/references/design.md +12 -0
- package/skills/ultra-review/references/errors.md +13 -0
- package/skills/ultra-review/references/spec.md +13 -0
- package/skills/ultra-review/references/tests.md +12 -0
- package/skills/ultra-review/references/worker-packet.md +40 -0
- package/skills/ultra-review/scripts/review_wait.py +26 -15
- package/skills/ultra-status/SKILL.md +61 -36
- package/skills/ultra-tdd/SKILL.md +81 -0
- package/skills/ultra-tdd/references/templates/README.md +20 -0
- package/skills/ultra-tdd/references/templates/feature-flag-default-audit.sh +79 -0
- package/skills/ultra-tdd/references/templates/persistence-real.ts +78 -0
- package/skills/ultra-tdd/references/templates/testcontainer-postgres.py +78 -0
- package/skills/ultra-tdd/references/templates/testcontainer-postgres.ts +73 -0
- package/skills/ultra-tdd/references/templates/vertical-slice.ts +66 -0
- package/skills/ultra-tdd/references/test-execution.md +18 -0
- package/skills/ultra-test/SKILL.md +75 -30
- package/skills/ultra-test/references/export-syntax.md +18 -0
- package/skills/ultra-test/scripts/worktree_digest.cjs +54 -0
- package/skills/ultra-think/SKILL.md +49 -27
- package/skills/ultra-think/references/autonomy-boundary.md +48 -0
- package/skills/ultra-think/references/interaction-boundary.md +18 -33
- package/.ultra-template/docs/research/README.md +0 -55
- package/.ultra-template/reports/templates/delivery-report.json +0 -17
- package/.ultra-template/reports/templates/test-report.json +0 -18
- package/.ultra-template/tasks/tasks.json +0 -15
- package/.ultra-template/templates/task-context.md +0 -19
- package/adapters/_shared/codex-assets.cjs +0 -725
- package/adapters/_shared/codex-ultra-tools-entry.cjs +0 -11
- package/adapters/_shared/interaction-contract.cjs +0 -129
- package/adapters/_shared/path-rewrite.cjs +0 -79
- package/adapters/_shared/runtime-native.cjs +0 -132
- package/adapters/_shared/settings-merge.cjs +0 -76
- package/agents/code-reviewer.md +0 -42
- package/agents/debugger.md +0 -40
- package/agents/review-code.md +0 -49
- package/agents/review-comments.md +0 -38
- package/agents/review-coordinator.md +0 -56
- package/agents/review-design.md +0 -40
- package/agents/review-errors.md +0 -43
- package/agents/review-spec.md +0 -39
- package/agents/review-tests.md +0 -40
- package/agents/tdd-runner.md +0 -38
- package/bin/orchestrator.js +0 -383
- package/commands/ultra-change.md +0 -10
- package/commands/ultra-deliver.md +0 -10
- package/commands/ultra-dev.md +0 -10
- package/commands/ultra-doctor.md +0 -10
- package/commands/ultra-init.md +0 -10
- package/commands/ultra-plan.md +0 -10
- package/commands/ultra-research.md +0 -10
- package/commands/ultra-review.md +0 -10
- package/commands/ultra-status.md +0 -10
- package/commands/ultra-test.md +0 -10
- package/commands/ultra-think.md +0 -10
- package/docs/AGENT-CONTEXT.md +0 -191
- package/docs/COMMIT-HASH-BACKFILL.md +0 -51
- package/docs/LEGACY-CLI-CROSSWALK.md +0 -175
- package/docs/ROADMAP.md +0 -101
- package/docs/STATE-DB-ACCESS-POLICY.md +0 -161
- package/hooks/active_task_context.py +0 -152
- package/hooks/context_envelope.py +0 -100
- package/hooks/health_check.py +0 -196
- package/hooks/pre_stop_check.py +0 -66
- package/hooks/runtime_paths.py +0 -396
- package/hooks/subagent_tracker.py +0 -88
- package/hooks/workflow_checkpoint.py +0 -76
- package/hooks/workflow_context.py +0 -48
- package/hooks/workflow_resume.py +0 -84
- package/mcp-server/hook-context.cjs +0 -38
- package/mcp-server/hook-event.cjs +0 -34
- package/mcp-server/lib/archive-journal.cjs +0 -1119
- package/mcp-server/lib/archive-mutation-worker.py +0 -365
- package/mcp-server/lib/artifact-registry.cjs +0 -1232
- package/mcp-server/lib/baseline-workflow.cjs +0 -1193
- package/mcp-server/lib/canonical-json.cjs +0 -19
- package/mcp-server/lib/change-authority.cjs +0 -26
- package/mcp-server/lib/change-packet.cjs +0 -790
- package/mcp-server/lib/change-workflow.cjs +0 -65
- package/mcp-server/lib/context-envelope.cjs +0 -581
- package/mcp-server/lib/context-paths.cjs +0 -142
- package/mcp-server/lib/decision-records.cjs +0 -423
- package/mcp-server/lib/delivery-transaction.cjs +0 -471
- package/mcp-server/lib/doctor-backup-worker.cjs +0 -328
- package/mcp-server/lib/doctor.cjs +0 -627
- package/mcp-server/lib/git-bootstrap.cjs +0 -651
- package/mcp-server/lib/init-project.cjs +0 -1021
- package/mcp-server/lib/kernel-change-workflow.cjs +0 -2029
- package/mcp-server/lib/legacy-change-workflow.cjs +0 -3032
- package/mcp-server/lib/managed-file-write.cjs +0 -172
- package/mcp-server/lib/plan-checkpoint.cjs +0 -177
- package/mcp-server/lib/plan-publication-worker.cjs +0 -830
- package/mcp-server/lib/plan-store.cjs +0 -794
- package/mcp-server/lib/prd-parser.cjs +0 -83
- package/mcp-server/lib/pricing.cjs +0 -44
- package/mcp-server/lib/project-context.cjs +0 -178
- package/mcp-server/lib/projector.cjs +0 -386
- package/mcp-server/lib/provider-refs.cjs +0 -42
- package/mcp-server/lib/runtime-paths.cjs +0 -1714
- package/mcp-server/lib/runtime-state.cjs +0 -222
- package/mcp-server/lib/safe-project-file.cjs +0 -385
- package/mcp-server/lib/stage-checkpoints.cjs +0 -463
- package/mcp-server/lib/state-authority.cjs +0 -95
- package/mcp-server/lib/state-db.cjs +0 -1580
- package/mcp-server/lib/state-ops.cjs +0 -1428
- package/mcp-server/lib/task-contract.cjs +0 -404
- package/mcp-server/lib/task-expander.cjs +0 -105
- package/mcp-server/lib/task-ledger.cjs +0 -1964
- package/mcp-server/lib/telemetry.cjs +0 -85
- package/mcp-server/lib/topo.cjs +0 -131
- package/mcp-server/lib/ultra-facade.cjs +0 -2684
- package/mcp-server/lib/worker-packet.cjs +0 -358
- package/mcp-server/server.cjs +0 -437
- package/orchestrator/auto-merge.cjs +0 -128
- package/orchestrator/daemon.cjs +0 -264
- package/orchestrator/dispatch-rules.cjs +0 -78
- package/orchestrator/parallel-orchestrator.cjs +0 -903
- package/orchestrator/planner/plan-builder.cjs +0 -125
- package/orchestrator/recovery.cjs +0 -188
- package/orchestrator/session-close-journal-worker.cjs +0 -5
- package/orchestrator/session-close-journal.cjs +0 -1014
- package/orchestrator/session-runner.cjs +0 -1153
- package/orchestrator/worktree-manager.cjs +0 -282
- package/settings.json +0 -7
- package/skills/cc-collab/SKILL.md +0 -42
- package/skills/code-review-expert/SKILL.md +0 -43
- package/skills/code-review-expert/references/correctness-reliability.md +0 -30
- package/skills/code-review-expert/references/design-boundaries.md +0 -26
- package/skills/code-review-expert/references/removal-plan.md +0 -24
- package/skills/codex-collab/SKILL.md +0 -49
- package/skills/codex-collab/evals/evals.json +0 -35
- package/skills/integration-rules/SKILL.md +0 -32
- package/skills/security-rules/SKILL.md +0 -38
- package/skills/testing-rules/SKILL.md +0 -32
- package/skills/ultra-doctor/SKILL.md +0 -41
- package/skills/ultra-plan/references/semantic-preflight.md +0 -20
- package/skills/ultra-verify/SKILL.md +0 -46
- package/skills/ultra-verify/evals/evals.json +0 -46
- package/skills/ultra-verify/references/cross-verify-modes.md +0 -28
- package/skills/ultra-verify/references/evidence-status.md +0 -21
- package/skills/ultra-verify/scripts/verify_wait.py +0 -94
- package/spec/cli-protocol.md +0 -102
- package/spec/mcp-tools.yaml +0 -312
- package/spec/schemas/baseline-reconciliation.v1.schema.json +0 -73
- package/spec/schemas/change-delta.v1.schema.json +0 -153
- package/spec/schemas/command-manifest.schema.json +0 -29
- package/spec/schemas/context-file.v4.5.schema.json +0 -54
- package/spec/schemas/delivery-report.v1.schema.json +0 -66
- package/spec/schemas/documentation-reconciliation.v1.schema.json +0 -106
- package/spec/schemas/mcp-tools.schema.json +0 -136
- package/spec/schemas/skill-manifest.schema.json +0 -24
- package/spec/schemas/state-db.sql +0 -641
- package/spec/schemas/task-ledger.v2.schema.json +0 -296
- package/spec/schemas/tasks.v4.5.schema.json +0 -96
- package/spec/schemas/test-report.v1.schema.json +0 -225
- package/ultra-tools/cli.cjs +0 -129
- package/ultra-tools/commands/db.cjs +0 -226
- package/ultra-tools/commands/legacy-memory.cjs +0 -159
- package/ultra-tools/commands/migrate.cjs +0 -1386
- package/ultra-tools/commands/session.cjs +0 -213
- package/ultra-tools/commands/status.cjs +0 -559
- package/ultra-tools/commands/system.cjs +0 -498
- package/ultra-tools/commands/task.cjs +0 -105
|
@@ -1,222 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
const { randomUUID } = require('node:crypto');
|
|
4
|
-
|
|
5
|
-
const ops = require('./state-ops.cjs');
|
|
6
|
-
const defaultProjector = require('./projector.cjs');
|
|
7
|
-
|
|
8
|
-
class RuntimeStateError extends Error {
|
|
9
|
-
constructor(code, message) {
|
|
10
|
-
super(message);
|
|
11
|
-
this.name = 'RuntimeStateError';
|
|
12
|
-
this.code = code;
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
function nowIso() {
|
|
17
|
-
return new Date().toISOString();
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
function parseJson(value) {
|
|
21
|
-
if (value == null) return null;
|
|
22
|
-
try { return JSON.parse(value); }
|
|
23
|
-
catch (error) {
|
|
24
|
-
throw new RuntimeStateError('STATE_CORRUPT', `invalid runtime JSON: ${error.message}`);
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
function rowToIncident(row) {
|
|
29
|
-
if (!row) return null;
|
|
30
|
-
return {
|
|
31
|
-
...row,
|
|
32
|
-
retryable: Boolean(row.retryable),
|
|
33
|
-
evidence: parseJson(row.evidence_json),
|
|
34
|
-
};
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
function recordIncident(db, input) {
|
|
38
|
-
if (!input || !input.code || !input.message) {
|
|
39
|
-
throw new RuntimeStateError('VALIDATION_ERROR', 'incident code and message required');
|
|
40
|
-
}
|
|
41
|
-
return ops.tx(db, () => {
|
|
42
|
-
const existing = db.prepare(
|
|
43
|
-
`SELECT * FROM incidents
|
|
44
|
-
WHERE status = 'open' AND code = ?
|
|
45
|
-
AND change_id IS ? AND task_id IS ? AND session_id IS ?
|
|
46
|
-
AND source_kind IS ? AND source_id IS ?
|
|
47
|
-
ORDER BY first_seen_at ASC LIMIT 1`,
|
|
48
|
-
).get(
|
|
49
|
-
input.code, input.change_id ?? null, input.task_id ?? null, input.session_id ?? null,
|
|
50
|
-
input.source_kind ?? null, input.source_id ?? null,
|
|
51
|
-
);
|
|
52
|
-
const ts = nowIso();
|
|
53
|
-
if (existing) {
|
|
54
|
-
db.prepare(
|
|
55
|
-
`UPDATE incidents SET message = ?, severity = ?, retryable = ?, evidence_json = ?,
|
|
56
|
-
occurrence_count = occurrence_count + 1, last_seen_at = ? WHERE id = ?`,
|
|
57
|
-
).run(
|
|
58
|
-
input.message, input.severity || 'error', input.retryable ? 1 : 0,
|
|
59
|
-
input.evidence === undefined ? existing.evidence_json : JSON.stringify(input.evidence),
|
|
60
|
-
ts, existing.id,
|
|
61
|
-
);
|
|
62
|
-
return rowToIncident(db.prepare('SELECT * FROM incidents WHERE id = ?').get(existing.id));
|
|
63
|
-
}
|
|
64
|
-
const id = `inc-${randomUUID().slice(0, 12)}`;
|
|
65
|
-
db.prepare(
|
|
66
|
-
`INSERT INTO incidents
|
|
67
|
-
(id, code, severity, retryable, message, change_id, task_id, session_id,
|
|
68
|
-
source_kind, source_id, evidence_json, first_seen_at, last_seen_at)
|
|
69
|
-
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`,
|
|
70
|
-
).run(
|
|
71
|
-
id, input.code, input.severity || 'error', input.retryable ? 1 : 0, input.message,
|
|
72
|
-
input.change_id ?? null, input.task_id ?? null, input.session_id ?? null,
|
|
73
|
-
input.source_kind ?? null, input.source_id ?? null,
|
|
74
|
-
input.evidence === undefined ? null : JSON.stringify(input.evidence), ts, ts,
|
|
75
|
-
);
|
|
76
|
-
return rowToIncident(db.prepare('SELECT * FROM incidents WHERE id = ?').get(id));
|
|
77
|
-
});
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
function resolveIncident(db, id, resolution) {
|
|
81
|
-
const result = db.prepare(
|
|
82
|
-
`UPDATE incidents SET status = 'resolved', resolved_at = ?, resolution = ?
|
|
83
|
-
WHERE id = ? AND status = 'open'`,
|
|
84
|
-
).run(nowIso(), resolution || 'resolved', id);
|
|
85
|
-
return { resolved: result.changes > 0 };
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
const LIST_INCIDENTS_SQL = "SELECT * FROM incidents WHERE (@status IS NULL OR status = @status) AND (@change_id IS NULL OR change_id = @change_id) AND (@task_id IS NULL OR task_id = @task_id) ORDER BY last_seen_at DESC LIMIT @maxn";
|
|
89
|
-
|
|
90
|
-
function listIncidents(db, { status = null, change_id = null, task_id = null, limit = 100 } = {}) {
|
|
91
|
-
return db.prepare(LIST_INCIDENTS_SQL).all({
|
|
92
|
-
status, change_id, task_id, maxn: Math.min(Math.max(limit, 1), 500),
|
|
93
|
-
}).map(rowToIncident);
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
function enqueueProjection(db, { tool_name, event_cursor, max_attempts = 3 } = {}) {
|
|
97
|
-
if (!tool_name) throw new RuntimeStateError('VALIDATION_ERROR', 'projection tool_name required');
|
|
98
|
-
const cursor = Number.isInteger(event_cursor)
|
|
99
|
-
? event_cursor
|
|
100
|
-
: Number(db.prepare('SELECT COALESCE(MAX(id), 0) AS id FROM events').get().id);
|
|
101
|
-
const result = db.prepare(
|
|
102
|
-
`INSERT INTO projection_jobs (tool_name, event_cursor, max_attempts)
|
|
103
|
-
VALUES (?, ?, ?)`,
|
|
104
|
-
).run(tool_name, cursor, max_attempts);
|
|
105
|
-
return readProjectionJob(db, Number(result.lastInsertRowid));
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
function readProjectionJob(db, id) {
|
|
109
|
-
return db.prepare('SELECT * FROM projection_jobs WHERE id = ?').get(id) || null;
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
const LIST_PROJECTION_JOBS_SQL = "SELECT * FROM projection_jobs WHERE (@status IS NULL OR status = @status) ORDER BY id ASC LIMIT @maxn";
|
|
113
|
-
|
|
114
|
-
function listProjectionJobs(db, { status = null, limit = 100 } = {}) {
|
|
115
|
-
return db.prepare(LIST_PROJECTION_JOBS_SQL).all({
|
|
116
|
-
status, maxn: Math.min(Math.max(limit, 1), 500),
|
|
117
|
-
});
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
function processProjectionJobs(db, {
|
|
121
|
-
rootDir = '.', project = defaultProjector.projectAll, limit = 10,
|
|
122
|
-
} = {}) {
|
|
123
|
-
const pending = listProjectionJobs(db, { status: 'pending', limit });
|
|
124
|
-
const jobs = [];
|
|
125
|
-
for (const row of pending) {
|
|
126
|
-
const claimed = db.prepare(
|
|
127
|
-
"UPDATE projection_jobs SET status = 'running', updated_at = ? WHERE id = ? AND status = 'pending'",
|
|
128
|
-
).run(nowIso(), row.id);
|
|
129
|
-
if (claimed.changes === 0) continue;
|
|
130
|
-
const active = readProjectionJob(db, row.id);
|
|
131
|
-
try {
|
|
132
|
-
const projection = project(db, { rootDir });
|
|
133
|
-
const ts = nowIso();
|
|
134
|
-
db.prepare(
|
|
135
|
-
`UPDATE projection_jobs SET status = 'completed', attempts = attempts + 1,
|
|
136
|
-
last_error = NULL, updated_at = ?, completed_at = ? WHERE id = ?`,
|
|
137
|
-
).run(ts, ts, row.id);
|
|
138
|
-
const related = db.prepare(
|
|
139
|
-
"SELECT id FROM incidents WHERE status = 'open' AND source_kind = 'projection_job' AND source_id = ?",
|
|
140
|
-
).all(String(row.id));
|
|
141
|
-
for (const incident of related) resolveIncident(db, incident.id, 'projection completed on retry');
|
|
142
|
-
jobs.push({ id: row.id, status: 'completed', projection });
|
|
143
|
-
} catch (error) {
|
|
144
|
-
const attempts = active.attempts + 1;
|
|
145
|
-
const status = attempts >= active.max_attempts ? 'failed' : 'pending';
|
|
146
|
-
db.prepare(
|
|
147
|
-
`UPDATE projection_jobs SET status = ?, attempts = ?, last_error = ?, updated_at = ?
|
|
148
|
-
WHERE id = ?`,
|
|
149
|
-
).run(status, attempts, error.message, nowIso(), row.id);
|
|
150
|
-
const incident = recordIncident(db, {
|
|
151
|
-
code: 'PROJECTION_FAILED', severity: 'error', retryable: true,
|
|
152
|
-
message: error.message, source_kind: 'projection_job', source_id: String(row.id),
|
|
153
|
-
evidence: { tool_name: row.tool_name, event_cursor: row.event_cursor, attempts },
|
|
154
|
-
});
|
|
155
|
-
jobs.push({ id: row.id, status: status === 'pending' ? 'retrying' : 'failed', error: error.message, incident_id: incident.id });
|
|
156
|
-
}
|
|
157
|
-
}
|
|
158
|
-
return { processed: jobs.length, jobs };
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
function requeueInterruptedProjections(db, { staleBefore } = {}) {
|
|
162
|
-
const cutoff = staleBefore || new Date(Date.now() - 5 * 60 * 1000).toISOString();
|
|
163
|
-
if (typeof cutoff !== 'string' || Number.isNaN(Date.parse(cutoff))) {
|
|
164
|
-
throw new RuntimeStateError('VALIDATION_ERROR', 'staleBefore must be an ISO date-time');
|
|
165
|
-
}
|
|
166
|
-
const result = db.prepare(
|
|
167
|
-
`UPDATE projection_jobs
|
|
168
|
-
SET status = 'pending', last_error = 'interrupted projection requeued by doctor',
|
|
169
|
-
updated_at = ?, completed_at = NULL
|
|
170
|
-
WHERE status = 'running' AND updated_at < ?`,
|
|
171
|
-
).run(nowIso(), cutoff);
|
|
172
|
-
return { requeued: result.changes, stale_before: cutoff };
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
function requeueFailedProjections(db) {
|
|
176
|
-
const result = db.prepare(
|
|
177
|
-
"UPDATE projection_jobs SET status = 'pending', attempts = 0, updated_at = ? WHERE status = 'failed'",
|
|
178
|
-
).run(nowIso());
|
|
179
|
-
return { requeued: result.changes };
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
function ensureProjectionJob(db, { tool_name = 'runtime.reconcile' } = {}) {
|
|
183
|
-
const eventCursor = Number(db.prepare('SELECT COALESCE(MAX(id), 0) AS id FROM events').get().id);
|
|
184
|
-
const projectedCursor = Number(db.prepare(
|
|
185
|
-
"SELECT COALESCE(MAX(event_cursor), 0) AS id FROM projection_jobs WHERE status IN ('pending', 'running', 'completed')",
|
|
186
|
-
).get().id);
|
|
187
|
-
if (eventCursor <= projectedCursor) return { enqueued: false, event_cursor: eventCursor };
|
|
188
|
-
return { enqueued: true, job: enqueueProjection(db, { tool_name, event_cursor: eventCursor }) };
|
|
189
|
-
}
|
|
190
|
-
|
|
191
|
-
function readConsumerCursor(db, name) {
|
|
192
|
-
const row = db.prepare('SELECT cursor FROM event_consumers WHERE name = ?').get(name);
|
|
193
|
-
return row ? Number(row.cursor) : 0;
|
|
194
|
-
}
|
|
195
|
-
|
|
196
|
-
function writeConsumerCursor(db, name, cursor) {
|
|
197
|
-
if (!name || !Number.isInteger(cursor) || cursor < 0) {
|
|
198
|
-
throw new RuntimeStateError('VALIDATION_ERROR', 'consumer name and non-negative cursor required');
|
|
199
|
-
}
|
|
200
|
-
db.prepare(
|
|
201
|
-
`INSERT INTO event_consumers (name, cursor, updated_at) VALUES (?, ?, ?)
|
|
202
|
-
ON CONFLICT(name) DO UPDATE SET
|
|
203
|
-
cursor = MAX(event_consumers.cursor, excluded.cursor), updated_at = excluded.updated_at`,
|
|
204
|
-
).run(name, cursor, nowIso());
|
|
205
|
-
return { name, cursor: readConsumerCursor(db, name) };
|
|
206
|
-
}
|
|
207
|
-
|
|
208
|
-
module.exports = {
|
|
209
|
-
RuntimeStateError,
|
|
210
|
-
recordIncident,
|
|
211
|
-
resolveIncident,
|
|
212
|
-
listIncidents,
|
|
213
|
-
enqueueProjection,
|
|
214
|
-
readProjectionJob,
|
|
215
|
-
listProjectionJobs,
|
|
216
|
-
processProjectionJobs,
|
|
217
|
-
requeueInterruptedProjections,
|
|
218
|
-
requeueFailedProjections,
|
|
219
|
-
ensureProjectionJob,
|
|
220
|
-
readConsumerCursor,
|
|
221
|
-
writeConsumerCursor,
|
|
222
|
-
};
|
|
@@ -1,385 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
const crypto = require('node:crypto');
|
|
4
|
-
const fs = require('node:fs');
|
|
5
|
-
const path = require('node:path');
|
|
6
|
-
|
|
7
|
-
class SafeProjectFileError extends Error {
|
|
8
|
-
constructor(code, message, details = undefined) {
|
|
9
|
-
super(message);
|
|
10
|
-
this.name = 'SafeProjectFileError';
|
|
11
|
-
this.code = code;
|
|
12
|
-
if (details !== undefined) this.details = details;
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
function fail(code, message, details = undefined) {
|
|
17
|
-
throw new SafeProjectFileError(code, message, details);
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
function normalizeProjectRelative(value) {
|
|
21
|
-
if (typeof value !== 'string' || value.trim() === '') {
|
|
22
|
-
fail('PROJECT_FILE_PATH_INVALID', 'project file path is required');
|
|
23
|
-
}
|
|
24
|
-
const raw = value.trim().replaceAll('\\', '/');
|
|
25
|
-
if (path.posix.isAbsolute(raw) || path.win32.isAbsolute(raw)) {
|
|
26
|
-
fail('PROJECT_FILE_PATH_INVALID', 'project file path must be project-relative');
|
|
27
|
-
}
|
|
28
|
-
const relative = path.posix.normalize(raw).replace(/^\.\//, '');
|
|
29
|
-
if (relative === '.' || relative === '..' || relative.startsWith('../')) {
|
|
30
|
-
fail('PROJECT_FILE_PATH_INVALID', `project file path escapes the project: ${value}`);
|
|
31
|
-
}
|
|
32
|
-
return relative;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
function identity(stat) {
|
|
36
|
-
return {
|
|
37
|
-
dev: String(stat.dev),
|
|
38
|
-
ino: String(stat.ino),
|
|
39
|
-
mode: stat.mode,
|
|
40
|
-
};
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
function sameIdentity(left, right) {
|
|
44
|
-
return left.dev === right.dev && left.ino === right.ino && left.mode === right.mode;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
function fileVersion(stat) {
|
|
48
|
-
return {
|
|
49
|
-
size: String(stat.size),
|
|
50
|
-
mtime_ns: String(stat.mtimeNs),
|
|
51
|
-
ctime_ns: String(stat.ctimeNs),
|
|
52
|
-
};
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
function sameFileVersion(left, right) {
|
|
56
|
-
return left.size === right.size
|
|
57
|
-
&& left.mtime_ns === right.mtime_ns
|
|
58
|
-
&& left.ctime_ns === right.ctime_ns;
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
function inspectProjectRoot(rootDir) {
|
|
62
|
-
const root = path.resolve(rootDir);
|
|
63
|
-
let stat;
|
|
64
|
-
try {
|
|
65
|
-
stat = fs.lstatSync(root);
|
|
66
|
-
} catch (cause) {
|
|
67
|
-
fail('PROJECT_ROOT_UNSAFE', `project root is unavailable: ${root}`, {
|
|
68
|
-
cause: cause.message,
|
|
69
|
-
});
|
|
70
|
-
}
|
|
71
|
-
if (stat.isSymbolicLink() || !stat.isDirectory()) {
|
|
72
|
-
fail('PROJECT_ROOT_UNSAFE', `project root must be a real directory: ${root}`);
|
|
73
|
-
}
|
|
74
|
-
let physicalRoot;
|
|
75
|
-
try {
|
|
76
|
-
physicalRoot = fs.realpathSync.native(root);
|
|
77
|
-
} catch (cause) {
|
|
78
|
-
fail('PROJECT_ROOT_UNSAFE', `project root cannot be resolved safely: ${root}`, {
|
|
79
|
-
cause: cause.message,
|
|
80
|
-
});
|
|
81
|
-
}
|
|
82
|
-
return {
|
|
83
|
-
root,
|
|
84
|
-
physicalRoot,
|
|
85
|
-
rootIdentity: identity(stat),
|
|
86
|
-
};
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
function inspectProjectFile(rootDir, candidate) {
|
|
90
|
-
const relative = normalizeProjectRelative(candidate);
|
|
91
|
-
const project = inspectProjectRoot(rootDir);
|
|
92
|
-
const components = relative.split('/').filter(Boolean);
|
|
93
|
-
const identities = [{
|
|
94
|
-
file: project.root,
|
|
95
|
-
relative: '.',
|
|
96
|
-
kind: 'directory',
|
|
97
|
-
...project.rootIdentity,
|
|
98
|
-
}];
|
|
99
|
-
let current = project.physicalRoot;
|
|
100
|
-
for (let index = 0; index < components.length; index += 1) {
|
|
101
|
-
current = path.join(current, components[index]);
|
|
102
|
-
const final = index === components.length - 1;
|
|
103
|
-
let stat;
|
|
104
|
-
try {
|
|
105
|
-
stat = fs.lstatSync(current);
|
|
106
|
-
} catch (cause) {
|
|
107
|
-
if (cause?.code === 'ENOENT' || cause?.code === 'ENOTDIR') {
|
|
108
|
-
fail('PROJECT_FILE_MISSING', `project file does not exist: ${relative}`);
|
|
109
|
-
}
|
|
110
|
-
fail('PROJECT_FILE_UNSAFE', `project file cannot be inspected safely: ${relative}`, {
|
|
111
|
-
component: components.slice(0, index + 1).join('/'),
|
|
112
|
-
cause: cause.message,
|
|
113
|
-
});
|
|
114
|
-
}
|
|
115
|
-
if (stat.isSymbolicLink()) {
|
|
116
|
-
fail('PROJECT_FILE_UNSAFE', `project file path contains a symbolic link: ${relative}`, {
|
|
117
|
-
component: components.slice(0, index + 1).join('/'),
|
|
118
|
-
});
|
|
119
|
-
}
|
|
120
|
-
if (final ? !stat.isFile() : !stat.isDirectory()) {
|
|
121
|
-
fail(
|
|
122
|
-
'PROJECT_FILE_UNSAFE',
|
|
123
|
-
`project file path contains a non-regular ${final ? 'file' : 'ancestor'}: ${relative}`,
|
|
124
|
-
{ component: components.slice(0, index + 1).join('/') },
|
|
125
|
-
);
|
|
126
|
-
}
|
|
127
|
-
let physical;
|
|
128
|
-
try {
|
|
129
|
-
physical = fs.realpathSync.native(current);
|
|
130
|
-
} catch (cause) {
|
|
131
|
-
fail('PROJECT_FILE_UNSAFE', `project file cannot be resolved safely: ${relative}`, {
|
|
132
|
-
component: components.slice(0, index + 1).join('/'),
|
|
133
|
-
cause: cause.message,
|
|
134
|
-
});
|
|
135
|
-
}
|
|
136
|
-
if (physical !== project.physicalRoot
|
|
137
|
-
&& !physical.startsWith(`${project.physicalRoot}${path.sep}`)) {
|
|
138
|
-
fail('PROJECT_FILE_UNSAFE', `project file escapes the physical project root: ${relative}`, {
|
|
139
|
-
component: components.slice(0, index + 1).join('/'),
|
|
140
|
-
physical,
|
|
141
|
-
});
|
|
142
|
-
}
|
|
143
|
-
identities.push({
|
|
144
|
-
file: current,
|
|
145
|
-
relative: components.slice(0, index + 1).join('/'),
|
|
146
|
-
kind: final ? 'file' : 'directory',
|
|
147
|
-
...identity(stat),
|
|
148
|
-
});
|
|
149
|
-
}
|
|
150
|
-
return {
|
|
151
|
-
...project,
|
|
152
|
-
relative,
|
|
153
|
-
file: current,
|
|
154
|
-
identities,
|
|
155
|
-
final: identities.at(-1),
|
|
156
|
-
};
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
function verifyProjectFileSnapshot(before, fd) {
|
|
160
|
-
const after = inspectProjectFile(before.root, before.relative);
|
|
161
|
-
let opened;
|
|
162
|
-
try {
|
|
163
|
-
opened = fs.fstatSync(fd);
|
|
164
|
-
} catch (cause) {
|
|
165
|
-
fail('PROJECT_FILE_UNSAFE', `project file descriptor is unavailable: ${before.relative}`, {
|
|
166
|
-
cause: cause.message,
|
|
167
|
-
});
|
|
168
|
-
}
|
|
169
|
-
if (!opened.isFile()
|
|
170
|
-
|| !sameIdentity(identity(opened), before.final)
|
|
171
|
-
|| before.identities.length !== after.identities.length
|
|
172
|
-
|| before.identities.some((entry, index) => (
|
|
173
|
-
entry.relative !== after.identities[index].relative
|
|
174
|
-
|| entry.kind !== after.identities[index].kind
|
|
175
|
-
|| !sameIdentity(entry, after.identities[index])
|
|
176
|
-
))) {
|
|
177
|
-
fail('PROJECT_FILE_UNSAFE', `project file path changed identity while it was read: ${before.relative}`);
|
|
178
|
-
}
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
function readStableFdSnapshot(fd, relative) {
|
|
182
|
-
let before;
|
|
183
|
-
try {
|
|
184
|
-
before = fs.fstatSync(fd, { bigint: true });
|
|
185
|
-
} catch (cause) {
|
|
186
|
-
fail('PROJECT_FILE_UNSAFE', `project file descriptor is unavailable: ${relative}`, {
|
|
187
|
-
cause: cause.message,
|
|
188
|
-
});
|
|
189
|
-
}
|
|
190
|
-
if (!before.isFile()) {
|
|
191
|
-
fail('PROJECT_FILE_UNSAFE', `project file descriptor is not a regular file: ${relative}`);
|
|
192
|
-
}
|
|
193
|
-
const size = Number(before.size);
|
|
194
|
-
if (!Number.isSafeInteger(size) || size < 0) {
|
|
195
|
-
fail('PROJECT_FILE_UNSAFE', `project file is too large to read safely: ${relative}`);
|
|
196
|
-
}
|
|
197
|
-
const bytes = Buffer.allocUnsafe(size);
|
|
198
|
-
let offset = 0;
|
|
199
|
-
while (offset < size) {
|
|
200
|
-
const count = fs.readSync(fd, bytes, offset, size - offset, offset);
|
|
201
|
-
if (count === 0) {
|
|
202
|
-
fail('PROJECT_FILE_CHANGED', `project file changed while it was read: ${relative}`);
|
|
203
|
-
}
|
|
204
|
-
offset += count;
|
|
205
|
-
}
|
|
206
|
-
const overflow = Buffer.allocUnsafe(1);
|
|
207
|
-
if (fs.readSync(fd, overflow, 0, 1, size) !== 0) {
|
|
208
|
-
fail('PROJECT_FILE_CHANGED', `project file changed while it was read: ${relative}`);
|
|
209
|
-
}
|
|
210
|
-
const after = fs.fstatSync(fd, { bigint: true });
|
|
211
|
-
const beforeVersion = fileVersion(before);
|
|
212
|
-
const afterVersion = fileVersion(after);
|
|
213
|
-
if (!after.isFile() || !sameFileVersion(beforeVersion, afterVersion)) {
|
|
214
|
-
fail('PROJECT_FILE_CHANGED', `project file changed while it was read: ${relative}`, {
|
|
215
|
-
before: beforeVersion,
|
|
216
|
-
after: afterVersion,
|
|
217
|
-
});
|
|
218
|
-
}
|
|
219
|
-
return {
|
|
220
|
-
bytes,
|
|
221
|
-
version: afterVersion,
|
|
222
|
-
digest: crypto.createHash('sha256').update(bytes).digest('hex'),
|
|
223
|
-
};
|
|
224
|
-
}
|
|
225
|
-
|
|
226
|
-
function openStableProjectRead(rootDir, candidate) {
|
|
227
|
-
const snapshot = inspectProjectFile(rootDir, candidate);
|
|
228
|
-
let fd;
|
|
229
|
-
try {
|
|
230
|
-
fd = fs.openSync(
|
|
231
|
-
snapshot.file,
|
|
232
|
-
fs.constants.O_RDONLY | (fs.constants.O_NOFOLLOW || 0),
|
|
233
|
-
);
|
|
234
|
-
verifyProjectFileSnapshot(snapshot, fd);
|
|
235
|
-
const initial = readStableFdSnapshot(fd, snapshot.relative);
|
|
236
|
-
verifyProjectFileSnapshot(snapshot, fd);
|
|
237
|
-
return {
|
|
238
|
-
root: snapshot.root,
|
|
239
|
-
physicalRoot: snapshot.physicalRoot,
|
|
240
|
-
relative: snapshot.relative,
|
|
241
|
-
file: snapshot.file,
|
|
242
|
-
bytes: initial.bytes,
|
|
243
|
-
digest: initial.digest,
|
|
244
|
-
verify() {
|
|
245
|
-
verifyProjectFileSnapshot(snapshot, fd);
|
|
246
|
-
const current = readStableFdSnapshot(fd, snapshot.relative);
|
|
247
|
-
if (!sameFileVersion(initial.version, current.version)
|
|
248
|
-
|| initial.digest !== current.digest) {
|
|
249
|
-
fail('PROJECT_FILE_CHANGED', `project file changed after it was read: ${snapshot.relative}`, {
|
|
250
|
-
expected_digest: initial.digest,
|
|
251
|
-
actual_digest: current.digest,
|
|
252
|
-
expected_version: initial.version,
|
|
253
|
-
actual_version: current.version,
|
|
254
|
-
});
|
|
255
|
-
}
|
|
256
|
-
verifyProjectFileSnapshot(snapshot, fd);
|
|
257
|
-
},
|
|
258
|
-
close() {
|
|
259
|
-
if (fd !== undefined) {
|
|
260
|
-
fs.closeSync(fd);
|
|
261
|
-
fd = undefined;
|
|
262
|
-
}
|
|
263
|
-
},
|
|
264
|
-
};
|
|
265
|
-
} catch (error) {
|
|
266
|
-
if (fd !== undefined) fs.closeSync(fd);
|
|
267
|
-
if (error instanceof SafeProjectFileError) throw error;
|
|
268
|
-
if (error?.code === 'ENOENT') {
|
|
269
|
-
fail('PROJECT_FILE_MISSING', `project file does not exist: ${snapshot.relative}`);
|
|
270
|
-
}
|
|
271
|
-
fail(
|
|
272
|
-
'PROJECT_FILE_UNSAFE',
|
|
273
|
-
`project file cannot be opened without following links: ${snapshot.relative}`,
|
|
274
|
-
{ cause: error.message },
|
|
275
|
-
);
|
|
276
|
-
}
|
|
277
|
-
}
|
|
278
|
-
|
|
279
|
-
function readStableProjectFile(rootDir, candidate, { encoding = null } = {}) {
|
|
280
|
-
const reader = openStableProjectRead(rootDir, candidate);
|
|
281
|
-
try {
|
|
282
|
-
reader.verify();
|
|
283
|
-
return {
|
|
284
|
-
root: reader.root,
|
|
285
|
-
physicalRoot: reader.physicalRoot,
|
|
286
|
-
relative: reader.relative,
|
|
287
|
-
file: reader.file,
|
|
288
|
-
bytes: reader.bytes,
|
|
289
|
-
text: encoding ? reader.bytes.toString(encoding) : null,
|
|
290
|
-
digest: reader.digest,
|
|
291
|
-
};
|
|
292
|
-
} finally {
|
|
293
|
-
reader.close();
|
|
294
|
-
}
|
|
295
|
-
}
|
|
296
|
-
|
|
297
|
-
function walkStableProjectTree(rootDir, candidate, {
|
|
298
|
-
ignore = () => false,
|
|
299
|
-
} = {}) {
|
|
300
|
-
const relativeRoot = normalizeProjectRelative(candidate);
|
|
301
|
-
const project = inspectProjectRoot(rootDir);
|
|
302
|
-
const absoluteRoot = path.join(project.physicalRoot, ...relativeRoot.split('/'));
|
|
303
|
-
let rootStat;
|
|
304
|
-
try {
|
|
305
|
-
rootStat = fs.lstatSync(absoluteRoot);
|
|
306
|
-
} catch (cause) {
|
|
307
|
-
if (cause?.code === 'ENOENT') return { files: [], unsafe: [] };
|
|
308
|
-
return {
|
|
309
|
-
files: [],
|
|
310
|
-
unsafe: [{ path: relativeRoot, reason: cause.message }],
|
|
311
|
-
};
|
|
312
|
-
}
|
|
313
|
-
if (rootStat.isSymbolicLink() || !rootStat.isDirectory()) {
|
|
314
|
-
return {
|
|
315
|
-
files: [],
|
|
316
|
-
unsafe: [{
|
|
317
|
-
path: relativeRoot,
|
|
318
|
-
reason: rootStat.isSymbolicLink()
|
|
319
|
-
? 'tree root is a symbolic link'
|
|
320
|
-
: 'tree root is not a directory',
|
|
321
|
-
}],
|
|
322
|
-
};
|
|
323
|
-
}
|
|
324
|
-
const files = [];
|
|
325
|
-
const unsafe = [];
|
|
326
|
-
|
|
327
|
-
const visit = (directory, relative, expected) => {
|
|
328
|
-
let entries;
|
|
329
|
-
try {
|
|
330
|
-
const before = fs.lstatSync(directory);
|
|
331
|
-
if (before.isSymbolicLink() || !before.isDirectory()
|
|
332
|
-
|| !sameIdentity(identity(before), expected)) {
|
|
333
|
-
unsafe.push({ path: relative, reason: 'directory identity changed' });
|
|
334
|
-
return;
|
|
335
|
-
}
|
|
336
|
-
entries = fs.readdirSync(directory, { withFileTypes: true });
|
|
337
|
-
const after = fs.lstatSync(directory);
|
|
338
|
-
if (after.isSymbolicLink() || !after.isDirectory()
|
|
339
|
-
|| !sameIdentity(identity(after), expected)) {
|
|
340
|
-
unsafe.push({ path: relative, reason: 'directory identity changed while listed' });
|
|
341
|
-
return;
|
|
342
|
-
}
|
|
343
|
-
} catch (cause) {
|
|
344
|
-
unsafe.push({ path: relative, reason: cause.message });
|
|
345
|
-
return;
|
|
346
|
-
}
|
|
347
|
-
for (const entry of entries) {
|
|
348
|
-
const childRelative = `${relative}/${entry.name}`;
|
|
349
|
-
const child = path.join(directory, entry.name);
|
|
350
|
-
let stat;
|
|
351
|
-
try {
|
|
352
|
-
stat = fs.lstatSync(child);
|
|
353
|
-
} catch (cause) {
|
|
354
|
-
unsafe.push({ path: childRelative, reason: cause.message });
|
|
355
|
-
continue;
|
|
356
|
-
}
|
|
357
|
-
if (stat.isSymbolicLink()) {
|
|
358
|
-
unsafe.push({ path: childRelative, reason: 'tree entry is a symbolic link' });
|
|
359
|
-
continue;
|
|
360
|
-
}
|
|
361
|
-
if (ignore(childRelative, entry, stat)) continue;
|
|
362
|
-
if (stat.isDirectory()) {
|
|
363
|
-
visit(child, childRelative, identity(stat));
|
|
364
|
-
continue;
|
|
365
|
-
}
|
|
366
|
-
if (!stat.isFile()) {
|
|
367
|
-
unsafe.push({ path: childRelative, reason: 'tree entry is not a regular file' });
|
|
368
|
-
continue;
|
|
369
|
-
}
|
|
370
|
-
files.push(childRelative);
|
|
371
|
-
}
|
|
372
|
-
};
|
|
373
|
-
|
|
374
|
-
visit(absoluteRoot, relativeRoot, identity(rootStat));
|
|
375
|
-
return { files, unsafe };
|
|
376
|
-
}
|
|
377
|
-
|
|
378
|
-
module.exports = {
|
|
379
|
-
SafeProjectFileError,
|
|
380
|
-
inspectProjectFile,
|
|
381
|
-
normalizeProjectRelative,
|
|
382
|
-
openStableProjectRead,
|
|
383
|
-
readStableProjectFile,
|
|
384
|
-
walkStableProjectTree,
|
|
385
|
-
};
|