@thebackstoryis/engineering-with-ai 0.2.9
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/Docs/README.md +50 -0
- package/Docs/adoption/consultancy-and-multi-project-rollout.md +135 -0
- package/Docs/adoption/non-technical-team-guide.md +126 -0
- package/Docs/archaeology-technology-and-hosting-discovery.md +212 -0
- package/Docs/blast-radius-and-impact-routing-guide.md +325 -0
- package/Docs/blueprints/internal-blueprint-catalogue.md +146 -0
- package/Docs/blueprints/maintaining-organisation-blueprints.md +154 -0
- package/Docs/blueprints/validation-and-troubleshooting.md +168 -0
- package/Docs/cli-reference.md +113 -0
- package/Docs/completed-phase-evidence-amendments.md +74 -0
- package/Docs/consultancy-network-rollout-control-plane-guide.md +202 -0
- package/Docs/context-aware-delivery-companion-guide.md +198 -0
- package/Docs/context-aware-delivery-companion-user-guide.md +184 -0
- package/Docs/context-management-and-token-efficiency.md +113 -0
- package/Docs/design-systems/design-system-implementation-guide.md +85 -0
- package/Docs/design-systems/design-system-pack-authoring-guide.md +95 -0
- package/Docs/design-systems/design-system-review-guide.md +51 -0
- package/Docs/design-systems/design-system-user-guide.md +96 -0
- package/Docs/design-systems/product-owner-guide.md +49 -0
- package/Docs/designing-organisation-blueprint-packs.md +384 -0
- package/Docs/developer-delivery-guide.md +224 -0
- package/Docs/error-reporting-guide.md +110 -0
- package/Docs/error-reporting-provider-guide.md +49 -0
- package/Docs/examples/error-report-adapter.md +70 -0
- package/Docs/examples/meeting-review.md +76 -0
- package/Docs/examples/minimal-design-system.md +67 -0
- package/Docs/examples/prototype-review-inputs.md +175 -0
- package/Docs/examples/reproducible-archaeology-depth-example.md +144 -0
- package/Docs/examples/test-scenario-input.md +68 -0
- package/Docs/examples/worked-examples.md +147 -0
- package/Docs/existing-project-onboarding-guide.md +214 -0
- package/Docs/explanation/core-concepts.md +26 -0
- package/Docs/explanation/delivery-workflow.md +48 -0
- package/Docs/governance/governance-team-guide.md +139 -0
- package/Docs/governed-starter-project-materialisation-guide.md +284 -0
- package/Docs/guide-catalogue.md +117 -0
- package/Docs/guided-discovery-facilitator-guide.md +172 -0
- package/Docs/guided-intent-workspace-guide.md +109 -0
- package/Docs/guided-phase-evidence-drafting-guide.md +119 -0
- package/Docs/human-approval-and-assurance-guide.md +146 -0
- package/Docs/knowledge-proposals-implementer-guide.md +106 -0
- package/Docs/knowledge-proposals-user-guide.md +247 -0
- package/Docs/maintainers/context-benchmarks.md +29 -0
- package/Docs/maintainers/contributing.md +58 -0
- package/Docs/maintainers/evidence-depth-acceptance.md +72 -0
- package/Docs/maintainers/verification-walkthroughs.md +104 -0
- package/Docs/meeting-evidence-implementer-guide.md +132 -0
- package/Docs/meeting-evidence-user-guide.md +200 -0
- package/Docs/operations/dashboard-and-delivery-state.md +153 -0
- package/Docs/operations/dashboard-configuration.md +87 -0
- package/Docs/operations/installation-updating-and-entitlements.md +135 -0
- package/Docs/operations/premium-personas-setup.md +76 -0
- package/Docs/operations/troubleshooting-and-recovery.md +205 -0
- package/Docs/organisation-rollout-guide.md +142 -0
- package/Docs/persona-entitlement-provider-guide.md +199 -0
- package/Docs/persona-guided-prototype-iteration.md +129 -0
- package/Docs/personas/organisation-specific-personas.md +103 -0
- package/Docs/personas/persona-authoring-cookbook.md +176 -0
- package/Docs/personas/persona-engagement-ui.md +133 -0
- package/Docs/personas/persona-governance.md +118 -0
- package/Docs/platform-export-analysis-guide.md +336 -0
- package/Docs/policies/governance-owner-guide.md +36 -0
- package/Docs/policies/implementation-guide.md +42 -0
- package/Docs/policies/organisation-policy-design-gates.md +58 -0
- package/Docs/policies/policy-pack-authoring-guide.md +108 -0
- package/Docs/policies/product-owner-guide.md +43 -0
- package/Docs/policies/technical-owner-guide.md +37 -0
- package/Docs/product-owner-guide.md +327 -0
- package/Docs/project-portfolio-orchestration-guide.md +199 -0
- package/Docs/quality/manual-qa-and-acceptance.md +162 -0
- package/Docs/quality/persona-driven-test-scenarios.md +172 -0
- package/Docs/quality/reproducible-archaeology-depth-review-checklist.md +89 -0
- package/Docs/reference/capabilities-and-project-layout.md +678 -0
- package/Docs/reference/cli-and-configuration.md +398 -0
- package/Docs/reference/contributions-api.md +23 -0
- package/Docs/reference/security-adapter-authoring.md +81 -0
- package/Docs/reference/starter-adapter-authoring.md +74 -0
- package/Docs/repository-source-map-guide.md +381 -0
- package/Docs/reproducible-archaeology-and-discovery-depth.md +292 -0
- package/Docs/screen-prototype-creation-guide.md +324 -0
- package/Docs/security-validation-guide.md +353 -0
- package/Docs/solution-readiness-review-guide.md +123 -0
- package/Docs/standards/project-standards-authoring.md +157 -0
- package/Docs/team-hub-guide.md +162 -0
- package/Docs/team-hub-resource-registry-guide.md +167 -0
- package/Docs/tutorials/first-delivery.md +83 -0
- package/Docs/tutorials/first-session.md +62 -0
- package/Docs/using-lifecycle-hooks.md +381 -0
- package/Docs/working-with-personas.md +274 -0
- package/LICENSE +165 -0
- package/README.md +96 -0
- package/agents-src/claude/ewai-security-reviewer.md +15 -0
- package/bin/ewai +5 -0
- package/config/archaeology-record-families.yaml +59 -0
- package/config/delivery-artifacts.yaml +121 -0
- package/config/delivery-stages.yaml +77 -0
- package/config/design-system.schema.json +46 -0
- package/config/error-reporting.schema.json +79 -0
- package/config/evidence-depth.schema.json +53 -0
- package/config/intent.schema.json +90 -0
- package/config/knowledge-proposals-proposal.schema.json +34 -0
- package/config/lifecycle-event.schema.json +68 -0
- package/config/lifecycle-handler.schema.json +45 -0
- package/config/lifecycle-hook-ack.schema.json +19 -0
- package/config/meeting-evidence-candidate.schema.json +102 -0
- package/config/organisation-policy.schema.json +137 -0
- package/config/pack.schema.json +250 -0
- package/config/persona-pack.schema.json +21 -0
- package/config/persona.schema.json +17 -0
- package/config/policy-evaluation.schema.json +77 -0
- package/config/policy-facts.schema.json +140 -0
- package/config/portfolio.schema.json +68 -0
- package/config/project.schema.json +313 -0
- package/config/prototype-iteration.schema.json +128 -0
- package/config/rollout.schema.json +87 -0
- package/config/security-adapter.schema.json +31 -0
- package/config/security-scan-request.schema.json +64 -0
- package/config/security-scan-response.schema.json +52 -0
- package/config/security-validation-policy.schema.json +74 -0
- package/config/starter-source-acknowledgement.schema.json +13 -0
- package/config/starter-source-adapter.schema.json +38 -0
- package/config/starter-source-request.schema.json +61 -0
- package/package.json +77 -0
- package/packs/core/pack.yaml +7 -0
- package/packs/design-systems/default/experience-promise.md +9 -0
- package/packs/design-systems/default/intentional-review.md +10 -0
- package/packs/design-systems/default/interaction-and-entry.md +9 -0
- package/packs/design-systems/default/meaningful-content-and-states.md +9 -0
- package/packs/design-systems/default/pack.yaml +44 -0
- package/packs/design-systems/default/principles.md +10 -0
- package/packs/personas/core/pack.yaml +7 -0
- package/packs/personas/core/personas/archaeologist.md +37 -0
- package/packs/personas/core/personas/end-user.md +17 -0
- package/packs/personas/core/personas/maintainer.md +17 -0
- package/packs/personas/core/personas/operator.md +17 -0
- package/packs/personas/core/personas/specs-knowledge-curator.md +35 -0
- package/packs/technologies/laravel/pack.yaml +30 -0
- package/packs/technologies/laravel-nuxt/pack.yaml +30 -0
- package/packs/technologies/nuxt/pack.yaml +30 -0
- package/packs/technologies/power-platform/pack.yaml +31 -0
- package/packs/technologies/salesforce/pack.yaml +25 -0
- package/public/app.js +4896 -0
- package/public/apple-touch-icon.png +0 -0
- package/public/assets/backstory-icon.png +0 -0
- package/public/dashboard-navigation.js +98 -0
- package/public/favicon-16.png +0 -0
- package/public/favicon-32.png +0 -0
- package/public/favicon.ico +0 -0
- package/public/index.html +789 -0
- package/public/styles.css +2693 -0
- package/public/team-hub/app.js +202 -0
- package/public/team-hub/index.html +79 -0
- package/public/team-hub/styles.css +90 -0
- package/scripts/publication-check.mjs +140 -0
- package/scripts/setup.mjs +21 -0
- package/skills-src/ewai-archaeology/SKILL.md +334 -0
- package/skills-src/ewai-archaeology/agents/openai.yaml +4 -0
- package/skills-src/ewai-archaeology/references/archaeology-contract.md +201 -0
- package/skills-src/ewai-archaeology/references/lifecycle-reconstruction.md +177 -0
- package/skills-src/ewai-archaeology/references/maximum-detail-reconstruction.md +97 -0
- package/skills-src/ewai-archaeology/references/model-routing.md +26 -0
- package/skills-src/ewai-architecture/SKILL.md +108 -0
- package/skills-src/ewai-architecture/agents/openai.yaml +4 -0
- package/skills-src/ewai-architecture/references/architecture-contract.md +176 -0
- package/skills-src/ewai-context/SKILL.md +68 -0
- package/skills-src/ewai-context/agents/openai.yaml +4 -0
- package/skills-src/ewai-context-import/SKILL.md +118 -0
- package/skills-src/ewai-context-import/agents/openai.yaml +4 -0
- package/skills-src/ewai-context-import/references/context-import-contract.md +106 -0
- package/skills-src/ewai-dashboard-configuration/SKILL.md +20 -0
- package/skills-src/ewai-deliver/SKILL.md +122 -0
- package/skills-src/ewai-deliver/references/delivery-evidence.md +92 -0
- package/skills-src/ewai-deliver/references/phase-routing.md +31 -0
- package/skills-src/ewai-design-system-apply/SKILL.md +27 -0
- package/skills-src/ewai-design-system-apply/agents/openai.yaml +4 -0
- package/skills-src/ewai-design-system-apply/references/application-contract.md +36 -0
- package/skills-src/ewai-design-system-author/SKILL.md +28 -0
- package/skills-src/ewai-design-system-author/agents/openai.yaml +4 -0
- package/skills-src/ewai-design-system-author/references/authoring-contract.md +38 -0
- package/skills-src/ewai-design-system-review/SKILL.md +26 -0
- package/skills-src/ewai-design-system-review/agents/openai.yaml +4 -0
- package/skills-src/ewai-design-system-review/references/review-contract.md +40 -0
- package/skills-src/ewai-error-reporting/SKILL.md +46 -0
- package/skills-src/ewai-error-reporting/agents/openai.yaml +4 -0
- package/skills-src/ewai-error-reporting/references/provider-contract.md +74 -0
- package/skills-src/ewai-evidence-depth/SKILL.md +72 -0
- package/skills-src/ewai-evidence-depth/agents/openai.yaml +4 -0
- package/skills-src/ewai-evidence-depth/references/evidence-depth-contract.md +127 -0
- package/skills-src/ewai-intent/SKILL.md +68 -0
- package/skills-src/ewai-intent/agents/openai.yaml +4 -0
- package/skills-src/ewai-intent/references/intent-contract.md +42 -0
- package/skills-src/ewai-knowledge-proposals/SKILL.md +105 -0
- package/skills-src/ewai-knowledge-proposals/agents/openai.yaml +4 -0
- package/skills-src/ewai-knowledge-proposals/references/proposal-contract.md +59 -0
- package/skills-src/ewai-meeting-evidence/SKILL.md +106 -0
- package/skills-src/ewai-meeting-evidence/agents/openai.yaml +4 -0
- package/skills-src/ewai-meeting-evidence/references/candidate-contract.md +64 -0
- package/skills-src/ewai-organisation-policy/SKILL.md +62 -0
- package/skills-src/ewai-organisation-policy/agents/openai.yaml +4 -0
- package/skills-src/ewai-organisation-policy/references/policy-contract.md +94 -0
- package/skills-src/ewai-palace-housekeeping/SKILL.md +55 -0
- package/skills-src/ewai-palace-housekeeping/agents/openai.yaml +4 -0
- package/skills-src/ewai-persona-entitlement/SKILL.md +60 -0
- package/skills-src/ewai-persona-entitlement/agents/openai.yaml +4 -0
- package/skills-src/ewai-phase-evidence/SKILL.md +79 -0
- package/skills-src/ewai-phase-evidence/agents/openai.yaml +4 -0
- package/skills-src/ewai-pipeline/SKILL.md +130 -0
- package/skills-src/ewai-pipeline/agents/openai.yaml +4 -0
- package/skills-src/ewai-pipeline/references/cli.md +86 -0
- package/skills-src/ewai-pipeline/references/specs-contract.md +16 -0
- package/skills-src/ewai-portfolio/SKILL.md +70 -0
- package/skills-src/ewai-portfolio/agents/openai.yaml +4 -0
- package/skills-src/ewai-portfolio/references/portfolio-contract.md +67 -0
- package/skills-src/ewai-project-discovery/SKILL.md +95 -0
- package/skills-src/ewai-project-discovery/agents/openai.yaml +4 -0
- package/skills-src/ewai-project-discovery/references/discovery-contract.md +34 -0
- package/skills-src/ewai-prototype-iteration/SKILL.md +30 -0
- package/skills-src/ewai-prototype-iteration/agents/openai.yaml +4 -0
- package/skills-src/ewai-prototype-iteration/references/review-contract.md +49 -0
- package/skills-src/ewai-retro/SKILL.md +48 -0
- package/skills-src/ewai-retro/agents/openai.yaml +4 -0
- package/skills-src/ewai-retro/references/asset-routing.md +14 -0
- package/skills-src/ewai-rollout/SKILL.md +74 -0
- package/skills-src/ewai-rollout/agents/openai.yaml +4 -0
- package/skills-src/ewai-rollout/references/rollout-contract.md +74 -0
- package/skills-src/ewai-shape-intents/SKILL.md +84 -0
- package/skills-src/ewai-shape-intents/agents/openai.yaml +4 -0
- package/skills-src/ewai-shape-intents/references/intent-mapping-contract.md +109 -0
- package/skills-src/ewai-solution-readiness/SKILL.md +55 -0
- package/skills-src/ewai-solution-readiness/agents/openai.yaml +4 -0
- package/skills-src/ewai-standards-check/SKILL.md +93 -0
- package/skills-src/ewai-standards-check/agents/openai.yaml +4 -0
- package/skills-src/ewai-standards-check/references/report-contract.md +116 -0
- package/skills-src/ewai-test-scenarios/SKILL.md +94 -0
- package/skills-src/ewai-test-scenarios/agents/openai.yaml +4 -0
- package/skills-src/ewai-test-scenarios/references/scenario-contract.md +88 -0
- package/src/afk-worker.mjs +16 -0
- package/src/archaeology.mjs +1333 -0
- package/src/checkin.mjs +261 -0
- package/src/cli.mjs +2427 -0
- package/src/companion-guidance.mjs +257 -0
- package/src/companion-opening.mjs +62 -0
- package/src/companion.mjs +256 -0
- package/src/context.mjs +210 -0
- package/src/dashboard-preferences.mjs +80 -0
- package/src/delivery-artifacts.mjs +204 -0
- package/src/delivery-documents.mjs +248 -0
- package/src/delivery-gates.mjs +317 -0
- package/src/delivery.mjs +1433 -0
- package/src/design-system-application.mjs +291 -0
- package/src/design-system-authoring.mjs +101 -0
- package/src/design-systems.mjs +466 -0
- package/src/discovery.mjs +1314 -0
- package/src/error-reporting.mjs +323 -0
- package/src/evidence-depth.mjs +543 -0
- package/src/execution-state.mjs +243 -0
- package/src/install.mjs +166 -0
- package/src/intent-dependencies.mjs +117 -0
- package/src/intent-maps.mjs +402 -0
- package/src/intents.mjs +747 -0
- package/src/knowledge-proposals.mjs +717 -0
- package/src/launcher.mjs +51 -0
- package/src/meeting-evidence.mjs +703 -0
- package/src/network-rollout.mjs +386 -0
- package/src/organisation-blueprints.mjs +438 -0
- package/src/organisation-policies.mjs +448 -0
- package/src/packs.mjs +44 -0
- package/src/paths.mjs +62 -0
- package/src/persona-entitlements.mjs +438 -0
- package/src/persona-licence-config.mjs +98 -0
- package/src/persona-website-provider.mjs +134 -0
- package/src/persona-zip.mjs +87 -0
- package/src/personas.mjs +159 -0
- package/src/platform-metadata-analysis.mjs +314 -0
- package/src/policy-design-gates.mjs +623 -0
- package/src/policy-gate-integration.mjs +318 -0
- package/src/portfolio.mjs +509 -0
- package/src/power-platform-source-map.mjs +190 -0
- package/src/project.mjs +449 -0
- package/src/prototype-iterations.mjs +730 -0
- package/src/repository-source-map.mjs +603 -0
- package/src/runtime/afk-conductor.mjs +973 -0
- package/src/runtime/context-assembly.mjs +457 -0
- package/src/runtime/context-benchmarks.mjs +115 -0
- package/src/runtime/dashboard-actions.mjs +109 -0
- package/src/runtime/dashboard-handoffs.mjs +149 -0
- package/src/runtime/dashboard-server.mjs +1272 -0
- package/src/runtime/dashboard.mjs +197 -0
- package/src/runtime/database.mjs +789 -0
- package/src/runtime/error-reporting.mjs +581 -0
- package/src/runtime/evidence-depth-workspace.mjs +412 -0
- package/src/runtime/execution-leases.mjs +299 -0
- package/src/runtime/guided-discovery.mjs +350 -0
- package/src/runtime/guided-intents.mjs +517 -0
- package/src/runtime/impact-analysis.mjs +535 -0
- package/src/runtime/intents.mjs +222 -0
- package/src/runtime/knowledge.mjs +86 -0
- package/src/runtime/lifecycle-hooks.mjs +1239 -0
- package/src/runtime/mcp-config.mjs +110 -0
- package/src/runtime/mcp-server.mjs +1885 -0
- package/src/runtime/palace.mjs +362 -0
- package/src/runtime/paths.mjs +58 -0
- package/src/runtime/persona-engagement.mjs +255 -0
- package/src/runtime/phase-contributions.mjs +594 -0
- package/src/runtime/policy-workspace.mjs +170 -0
- package/src/runtime/prototype-iterations.mjs +235 -0
- package/src/runtime/provider-adapters.mjs +163 -0
- package/src/runtime/repository-index.mjs +838 -0
- package/src/runtime/runs.mjs +185 -0
- package/src/runtime/security-validation.mjs +1230 -0
- package/src/runtime/starter-materialisation.mjs +1155 -0
- package/src/runtime/team-hub-client.mjs +479 -0
- package/src/runtime/team-hub-database.mjs +288 -0
- package/src/runtime/team-hub-server.mjs +191 -0
- package/src/runtime/team-hub.mjs +110 -0
- package/src/runtime/tree-sitter-index.mjs +390 -0
- package/src/runtime/version.mjs +1 -0
- package/src/runtime/work.mjs +633 -0
- package/src/salesforce-source-map.mjs +212 -0
- package/src/security-validation-config.mjs +224 -0
- package/src/solution-readiness.mjs +620 -0
- package/src/starter-materialisation-contract.mjs +407 -0
- package/src/task-graph.mjs +544 -0
- package/src/team-hub-resources.mjs +239 -0
- package/src/team-hub.mjs +242 -0
- package/src/test-scenarios.mjs +622 -0
- package/src/validation-config.mjs +289 -0
- package/templates/SPECS/1.Scope/personas/registry.yaml +12 -0
- package/templates/SPECS/5.Strategy/patterns/context-packet.md +119 -0
- package/templates/SPECS/6.Build/_tracker-template.md +16 -0
- package/templates/SPECS/pipeline.yaml +62 -0
- package/templates/discovery-answers.yaml +86 -0
- package/templates/intent-body.md +21 -0
- package/tests/fixtures/context-benchmarks.json +9 -0
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
const state = { portfolio: null, selectedId: null, resources: null, selectedResource: null };
|
|
2
|
+
const tokenInput = document.querySelector('#hubToken');
|
|
3
|
+
const message = document.querySelector('#message');
|
|
4
|
+
const portfolioSection = document.querySelector('#portfolio');
|
|
5
|
+
const projectList = document.querySelector('#projectList');
|
|
6
|
+
const projectDetail = document.querySelector('#projectDetail');
|
|
7
|
+
const summary = document.querySelector('#summary');
|
|
8
|
+
const resourceRegistry = document.querySelector('#resourceRegistry');
|
|
9
|
+
const resourceList = document.querySelector('#resourceList');
|
|
10
|
+
const resourceDetail = document.querySelector('#resourceDetail');
|
|
11
|
+
|
|
12
|
+
function el(name, className, text) {
|
|
13
|
+
const node = document.createElement(name);
|
|
14
|
+
if (className) node.className = className;
|
|
15
|
+
if (text !== undefined) node.textContent = String(text);
|
|
16
|
+
return node;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
async function teamHubApi(path, token = sessionStorage.getItem('ewai.team-hub.token')) {
|
|
20
|
+
const response = await fetch(path, { headers: token ? { authorization: `Bearer ${token}` } : {} });
|
|
21
|
+
const body = await response.json().catch(() => null);
|
|
22
|
+
if (!response.ok) throw new Error(body?.error?.message ?? `Team Hub returned HTTP ${response.status}.`);
|
|
23
|
+
return body;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
function evidenceRow(label, value) {
|
|
27
|
+
const row = el('div', 'evidence-row');
|
|
28
|
+
row.append(el('dt', '', label), el('dd', '', value ?? 'Not available'));
|
|
29
|
+
return row;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
function renderSummary() {
|
|
33
|
+
summary.replaceChildren();
|
|
34
|
+
for (const [label, value] of Object.entries({ Projects: state.portfolio.summary.total, Current: state.portfolio.summary.current, Stale: state.portfolio.summary.stale, Attention: state.portfolio.summary.attention })) {
|
|
35
|
+
const card = el('div', 'summary-card');
|
|
36
|
+
card.append(el('span', 'summary-value', value), el('span', 'summary-label', label));
|
|
37
|
+
summary.append(card);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
function renderDetail() {
|
|
42
|
+
const project = state.portfolio?.projects.find(({ id }) => id === state.selectedId);
|
|
43
|
+
projectDetail.replaceChildren();
|
|
44
|
+
if (!project) {
|
|
45
|
+
projectDetail.append(el('p', 'empty-state', 'Choose a connected project.'));
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
const heading = el('header', 'detail-heading');
|
|
49
|
+
const title = el('div');
|
|
50
|
+
title.append(el('p', 'eyebrow', 'SELECTED PROJECT'), el('h3', '', project.name));
|
|
51
|
+
heading.append(title, el('span', `freshness freshness-${project.freshness.state}`, project.freshness.state));
|
|
52
|
+
const evidence = el('dl', 'evidence-grid');
|
|
53
|
+
evidence.append(
|
|
54
|
+
evidenceRow('Last accepted', project.evidence.acceptedAt),
|
|
55
|
+
evidenceRow('Submitted', project.evidence.submittedAt),
|
|
56
|
+
evidenceRow('Receipt', project.evidence.receiptId),
|
|
57
|
+
evidenceRow('Snapshot digest', project.evidence.snapshotDigest),
|
|
58
|
+
evidenceRow('EWAI', project.ewaiVersion),
|
|
59
|
+
evidenceRow('Revision digest', project.revisionDigest),
|
|
60
|
+
);
|
|
61
|
+
const delivery = el('section', 'detail-section');
|
|
62
|
+
delivery.append(el('h4', '', 'Latest delivery'));
|
|
63
|
+
if (project.delivery) {
|
|
64
|
+
delivery.append(el('p', '', `${project.delivery.title} · ${project.delivery.currentPhase} · ${project.delivery.status}`));
|
|
65
|
+
} else delivery.append(el('p', 'muted', 'No delivery summary was submitted.'));
|
|
66
|
+
const attention = el('section', 'detail-section');
|
|
67
|
+
attention.append(el('h4', '', 'Attention'));
|
|
68
|
+
if (!project.attention.length) attention.append(el('p', 'muted', 'No bounded attention items were submitted or derived.'));
|
|
69
|
+
else {
|
|
70
|
+
const list = el('ul', 'attention-list');
|
|
71
|
+
for (const item of project.attention) list.append(el('li', `attention-${item.severity}`, item.summary));
|
|
72
|
+
attention.append(list);
|
|
73
|
+
}
|
|
74
|
+
projectDetail.append(heading, evidence, delivery, attention);
|
|
75
|
+
projectDetail.focus();
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
function renderProjects() {
|
|
79
|
+
projectList.replaceChildren();
|
|
80
|
+
for (const project of state.portfolio.projects) {
|
|
81
|
+
const item = el('li');
|
|
82
|
+
const button = el('button', 'project-button');
|
|
83
|
+
button.type = 'button';
|
|
84
|
+
button.dataset.projectId = project.id;
|
|
85
|
+
button.setAttribute('aria-current', project.id === state.selectedId ? 'true' : 'false');
|
|
86
|
+
button.append(el('span', 'project-name', project.name), el('span', 'project-meta', `${project.freshness.state} · ${project.attention.length} attention`));
|
|
87
|
+
item.append(button);
|
|
88
|
+
projectList.append(item);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
function resourceKey(resource) { return `${resource.id}@${resource.version}`; }
|
|
93
|
+
|
|
94
|
+
function renderResourceDetail() {
|
|
95
|
+
const resource = state.resources?.releases.find((item) => resourceKey(item) === state.selectedResource);
|
|
96
|
+
resourceDetail.replaceChildren();
|
|
97
|
+
if (!resource) {
|
|
98
|
+
resourceDetail.append(el('p', 'empty-state', 'Choose an immutable release.'));
|
|
99
|
+
return;
|
|
100
|
+
}
|
|
101
|
+
const heading = el('header', 'detail-heading');
|
|
102
|
+
const title = el('div');
|
|
103
|
+
title.append(el('p', 'eyebrow', resource.kind.replaceAll('-', ' ').toUpperCase()), el('h3', '', resource.name));
|
|
104
|
+
heading.append(title, el('span', 'freshness freshness-current', `v${resource.version}`));
|
|
105
|
+
const identity = el('dl', 'evidence-grid');
|
|
106
|
+
identity.append(
|
|
107
|
+
evidenceRow('Resource ID', resource.id),
|
|
108
|
+
evidenceRow('Package digest', resource.digest),
|
|
109
|
+
evidenceRow('Publisher', `${resource.publisher.name} (${resource.publisher.id})`),
|
|
110
|
+
evidenceRow('EWAI compatibility', resource.compatibility.ewai),
|
|
111
|
+
evidenceRow('Package bounds', `${resource.fileCount} files · ${resource.totalBytes} bytes`),
|
|
112
|
+
evidenceRow('Published', resource.publishedAt),
|
|
113
|
+
evidenceRow('Receipt', resource.receiptId),
|
|
114
|
+
);
|
|
115
|
+
const boundary = el('section', 'detail-section');
|
|
116
|
+
boundary.append(el('h4', '', 'Authority boundary'), el('p', 'muted', 'This release is available to authenticated readers. A contributor must still download, verify, explicitly install, then select or apply it separately.'));
|
|
117
|
+
const chain = el('section', 'detail-section');
|
|
118
|
+
chain.append(el('h4', '', 'Retained versions'));
|
|
119
|
+
const versions = el('ul', 'attention-list');
|
|
120
|
+
for (const release of state.resources.releases.filter(({ id }) => id === resource.id)) {
|
|
121
|
+
versions.append(el('li', '', `v${release.version} · ${release.digest}`));
|
|
122
|
+
}
|
|
123
|
+
chain.append(versions);
|
|
124
|
+
resourceDetail.append(heading, identity, chain, boundary);
|
|
125
|
+
resourceDetail.focus();
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
function renderResources() {
|
|
129
|
+
resourceList.replaceChildren();
|
|
130
|
+
for (const resource of state.resources?.releases ?? []) {
|
|
131
|
+
const item = el('li');
|
|
132
|
+
const button = el('button', 'project-button');
|
|
133
|
+
button.type = 'button';
|
|
134
|
+
button.dataset.resourceKey = resourceKey(resource);
|
|
135
|
+
button.setAttribute('aria-current', resourceKey(resource) === state.selectedResource ? 'true' : 'false');
|
|
136
|
+
button.append(el('span', 'project-name', resource.name), el('span', 'project-meta', `${resource.kind.replaceAll('-', ' ')} · v${resource.version}`));
|
|
137
|
+
item.append(button); resourceList.append(item);
|
|
138
|
+
}
|
|
139
|
+
if (!(state.resources?.releases?.length)) resourceList.append(el('li', 'empty-state', 'No governed releases have been published.'));
|
|
140
|
+
renderResourceDetail();
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
async function loadResources(token) {
|
|
144
|
+
state.resources = await teamHubApi('/api/v1/resources', token);
|
|
145
|
+
state.selectedResource = state.resources.releases[0] ? resourceKey(state.resources.releases[0]) : null;
|
|
146
|
+
resourceRegistry.hidden = false;
|
|
147
|
+
renderResources();
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
async function loadPortfolio(token) {
|
|
151
|
+
message.textContent = 'Loading portfolio…';
|
|
152
|
+
try {
|
|
153
|
+
state.portfolio = await teamHubApi('/api/v1/portfolio', token);
|
|
154
|
+
state.selectedId = state.portfolio.projects[0]?.id ?? null;
|
|
155
|
+
portfolioSection.hidden = false;
|
|
156
|
+
renderSummary(); renderProjects(); renderDetail();
|
|
157
|
+
message.textContent = `Portfolio refreshed at ${state.portfolio.generatedAt}.`;
|
|
158
|
+
} catch (error) {
|
|
159
|
+
portfolioSection.hidden = true;
|
|
160
|
+
message.textContent = error.message;
|
|
161
|
+
throw error;
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
async function loadHubSurfaces(token) {
|
|
166
|
+
const results = await Promise.allSettled([loadPortfolio(token), loadResources(token)]);
|
|
167
|
+
if (results.some(({ status }) => status === 'fulfilled')) {
|
|
168
|
+
sessionStorage.setItem('ewai.team-hub.token', token);
|
|
169
|
+
message.textContent = 'Authenticated views refreshed.';
|
|
170
|
+
return;
|
|
171
|
+
}
|
|
172
|
+
sessionStorage.removeItem('ewai.team-hub.token');
|
|
173
|
+
throw results[0].reason;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
document.querySelector('#accessForm').addEventListener('submit', (event) => {
|
|
177
|
+
event.preventDefault();
|
|
178
|
+
const token = tokenInput.value;
|
|
179
|
+
loadHubSurfaces(token).catch((error) => { message.textContent = error.message; });
|
|
180
|
+
tokenInput.value = '';
|
|
181
|
+
});
|
|
182
|
+
document.querySelector('#refreshPortfolio').addEventListener('click', () => loadPortfolio(sessionStorage.getItem('ewai.team-hub.token')).catch((error) => { message.textContent = error.message; }));
|
|
183
|
+
document.querySelector('#refreshResources').addEventListener('click', () => loadResources(sessionStorage.getItem('ewai.team-hub.token')).catch((error) => { message.textContent = error.message; }));
|
|
184
|
+
projectList.addEventListener('click', (event) => {
|
|
185
|
+
const button = event.target.closest('[data-project-id]');
|
|
186
|
+
if (!button) return;
|
|
187
|
+
state.selectedId = button.dataset.projectId;
|
|
188
|
+
renderProjects(); renderDetail();
|
|
189
|
+
});
|
|
190
|
+
resourceList.addEventListener('click', (event) => {
|
|
191
|
+
const button = event.target.closest('[data-resource-key]');
|
|
192
|
+
if (!button) return;
|
|
193
|
+
state.selectedResource = button.dataset.resourceKey;
|
|
194
|
+
renderResources();
|
|
195
|
+
});
|
|
196
|
+
|
|
197
|
+
teamHubApi('/health', '').then((health) => {
|
|
198
|
+
document.querySelector('#serviceState').textContent = `${health.status} · ${health.bind} · built-in TLS ${health.tls ? 'on' : 'off'}`;
|
|
199
|
+
}).catch(() => { document.querySelector('#serviceState').textContent = 'Service health unavailable'; });
|
|
200
|
+
|
|
201
|
+
const sessionToken = sessionStorage.getItem('ewai.team-hub.token');
|
|
202
|
+
if (sessionToken) loadHubSurfaces(sessionToken).catch(() => {});
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8">
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
6
|
+
<title>EWAI Team Hub</title>
|
|
7
|
+
<link rel="stylesheet" href="/styles.css">
|
|
8
|
+
</head>
|
|
9
|
+
<body>
|
|
10
|
+
<a class="skip-link" href="#main">Skip to portfolio</a>
|
|
11
|
+
<header class="masthead">
|
|
12
|
+
<div>
|
|
13
|
+
<p class="eyebrow">EWAI · TEAM HUB</p>
|
|
14
|
+
<h1>Connected portfolio</h1>
|
|
15
|
+
</div>
|
|
16
|
+
<div id="serviceState" class="service-state" aria-live="polite">Checking service…</div>
|
|
17
|
+
</header>
|
|
18
|
+
|
|
19
|
+
<main id="main">
|
|
20
|
+
<section class="access-panel" aria-labelledby="accessHeading">
|
|
21
|
+
<div>
|
|
22
|
+
<p class="eyebrow">SESSION ACCESS</p>
|
|
23
|
+
<h2 id="accessHeading">Open this portfolio</h2>
|
|
24
|
+
<p>The bearer token stays in this browser tab only. Team Hub does not persist it in browser storage.</p>
|
|
25
|
+
</div>
|
|
26
|
+
<form id="accessForm">
|
|
27
|
+
<label for="hubToken">Team Hub token</label>
|
|
28
|
+
<div class="input-row">
|
|
29
|
+
<input id="hubToken" name="token" type="password" autocomplete="off" required minlength="16">
|
|
30
|
+
<button type="submit">Load portfolio</button>
|
|
31
|
+
</div>
|
|
32
|
+
</form>
|
|
33
|
+
</section>
|
|
34
|
+
|
|
35
|
+
<section class="authority-note" aria-label="Authority boundary">
|
|
36
|
+
<strong>Read-only operational evidence.</strong>
|
|
37
|
+
<span>Team Hub cannot approve Build or Manual QA, accept risk, certify compliance, deploy or release.</span>
|
|
38
|
+
</section>
|
|
39
|
+
|
|
40
|
+
<section id="portfolio" class="portfolio" hidden aria-labelledby="portfolioHeading">
|
|
41
|
+
<header class="section-heading">
|
|
42
|
+
<div>
|
|
43
|
+
<p class="eyebrow">PORTFOLIO EVIDENCE</p>
|
|
44
|
+
<h2 id="portfolioHeading">Projects</h2>
|
|
45
|
+
</div>
|
|
46
|
+
<button id="refreshPortfolio" class="quiet-button" type="button">Refresh</button>
|
|
47
|
+
</header>
|
|
48
|
+
<div id="summary" class="summary-grid" aria-live="polite"></div>
|
|
49
|
+
<div class="portfolio-grid">
|
|
50
|
+
<nav aria-label="Connected projects">
|
|
51
|
+
<ul id="projectList" class="project-list"></ul>
|
|
52
|
+
</nav>
|
|
53
|
+
<article id="projectDetail" class="project-detail" tabindex="-1">
|
|
54
|
+
<p class="empty-state">Load the portfolio, then choose a project.</p>
|
|
55
|
+
</article>
|
|
56
|
+
</div>
|
|
57
|
+
</section>
|
|
58
|
+
<section id="resourceRegistry" class="resource-registry" hidden aria-labelledby="resourceRegistryHeading">
|
|
59
|
+
<header class="section-heading">
|
|
60
|
+
<div>
|
|
61
|
+
<p class="eyebrow">GOVERNED RESOURCES</p>
|
|
62
|
+
<h2 id="resourceRegistryHeading">Release catalogue</h2>
|
|
63
|
+
<p>Immutable organisation Blueprint and design-system releases. Publication is not project activation.</p>
|
|
64
|
+
</div>
|
|
65
|
+
<button id="refreshResources" class="quiet-button" type="button">Refresh resources</button>
|
|
66
|
+
</header>
|
|
67
|
+
<div class="release-chain" aria-label="Resource release chain">
|
|
68
|
+
<strong>Published</strong><span>→</span><strong>Downloaded</strong><span>→</span><strong>Verified</strong><span>→</span><strong>Installed</strong><span>→</span><strong>Select/apply separately</strong>
|
|
69
|
+
</div>
|
|
70
|
+
<div class="resource-grid">
|
|
71
|
+
<nav aria-label="Published resource releases"><ul id="resourceList" class="project-list"></ul></nav>
|
|
72
|
+
<article id="resourceDetail" class="project-detail" tabindex="-1"><p class="empty-state">Load the catalogue, then choose a release.</p></article>
|
|
73
|
+
</div>
|
|
74
|
+
</section>
|
|
75
|
+
<p id="message" class="message" role="status" aria-live="polite"></p>
|
|
76
|
+
</main>
|
|
77
|
+
<script type="module" src="/app.js"></script>
|
|
78
|
+
</body>
|
|
79
|
+
</html>
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
:root {
|
|
2
|
+
color-scheme: light;
|
|
3
|
+
--ink: #172033;
|
|
4
|
+
--muted: #5f6b7b;
|
|
5
|
+
--line: #d8dee7;
|
|
6
|
+
--paper: #f5f7fa;
|
|
7
|
+
--surface: #ffffff;
|
|
8
|
+
--blue: #2556a8;
|
|
9
|
+
--blue-dark: #183c78;
|
|
10
|
+
--green: #216a52;
|
|
11
|
+
--amber: #8a5a13;
|
|
12
|
+
font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
|
|
13
|
+
}
|
|
14
|
+
* { box-sizing: border-box; }
|
|
15
|
+
body { margin: 0; color: var(--ink); background: var(--paper); line-height: 1.5; }
|
|
16
|
+
button, input { font: inherit; }
|
|
17
|
+
button { cursor: pointer; }
|
|
18
|
+
.skip-link { position: fixed; top: 0; left: 1rem; transform: translateY(-120%); padding: .7rem 1rem; background: var(--ink); color: white; z-index: 10; }
|
|
19
|
+
.skip-link:focus { transform: translateY(0); }
|
|
20
|
+
.masthead { display: flex; align-items: flex-end; justify-content: space-between; gap: 2rem; padding: 2.5rem max(1.25rem, calc((100vw - 1180px) / 2)); background: #172033; color: white; border-bottom: 5px solid #4f80cc; }
|
|
21
|
+
.masthead h1 { margin: .15rem 0 0; font-size: clamp(2rem, 5vw, 4rem); line-height: .98; letter-spacing: -.04em; }
|
|
22
|
+
.eyebrow { margin: 0; color: #718099; font-size: .74rem; font-weight: 800; letter-spacing: .14em; }
|
|
23
|
+
.masthead .eyebrow { color: #a9bddb; }
|
|
24
|
+
.service-state { padding: .45rem .7rem; border: 1px solid #526177; color: #d7e2f1; font-size: .83rem; }
|
|
25
|
+
main { width: min(1180px, calc(100% - 2.5rem)); margin: 2rem auto 4rem; }
|
|
26
|
+
.access-panel { display: grid; grid-template-columns: minmax(0, 1fr) minmax(320px, .8fr); gap: 2rem; align-items: end; padding: 1.6rem; background: var(--surface); border: 1px solid var(--line); border-top: 4px solid var(--blue); }
|
|
27
|
+
.access-panel h2, .section-heading h2 { margin: .2rem 0 .5rem; font-size: 1.55rem; }
|
|
28
|
+
.access-panel p { margin-bottom: 0; color: var(--muted); }
|
|
29
|
+
label { display: block; margin-bottom: .45rem; font-size: .82rem; font-weight: 800; }
|
|
30
|
+
.input-row { display: flex; gap: .6rem; }
|
|
31
|
+
input { width: 100%; min-width: 0; padding: .75rem .85rem; border: 1px solid #aab4c2; background: white; color: var(--ink); }
|
|
32
|
+
button { padding: .72rem 1rem; border: 1px solid var(--blue); background: var(--blue); color: white; font-weight: 750; white-space: nowrap; }
|
|
33
|
+
button:hover { background: var(--blue-dark); }
|
|
34
|
+
button:focus-visible, input:focus-visible, [tabindex]:focus-visible, a:focus-visible { outline: 3px solid #e2a32a; outline-offset: 3px; }
|
|
35
|
+
.authority-note { display: flex; gap: .6rem; margin: 1rem 0 2rem; padding: .85rem 1rem; border-left: 4px solid var(--amber); background: #fff9ee; color: #594319; }
|
|
36
|
+
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; }
|
|
37
|
+
.quiet-button { border-color: #9ca8b8; background: white; color: var(--ink); }
|
|
38
|
+
.summary-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: .75rem; margin-bottom: .75rem; }
|
|
39
|
+
.summary-card { display: flex; align-items: baseline; justify-content: space-between; padding: 1rem; border: 1px solid var(--line); background: var(--surface); }
|
|
40
|
+
.summary-value { font-size: 1.6rem; font-weight: 850; }
|
|
41
|
+
.summary-label { color: var(--muted); font-size: .8rem; text-transform: uppercase; letter-spacing: .08em; }
|
|
42
|
+
.portfolio-grid { display: grid; grid-template-columns: minmax(260px, .62fr) minmax(0, 1.38fr); min-height: 460px; border: 1px solid var(--line); background: var(--surface); }
|
|
43
|
+
.project-list { margin: 0; padding: 0; list-style: none; border-right: 1px solid var(--line); }
|
|
44
|
+
.project-list li + li { border-top: 1px solid var(--line); }
|
|
45
|
+
.project-button { display: block; width: 100%; padding: 1rem; border: 0; border-left: 4px solid transparent; background: white; color: var(--ink); text-align: left; white-space: normal; }
|
|
46
|
+
.project-button:hover { background: #f4f7fb; }
|
|
47
|
+
.project-button[aria-current="true"] { border-left-color: var(--blue); background: #eef4fc; }
|
|
48
|
+
.project-name, .project-meta { display: block; }
|
|
49
|
+
.project-name { font-weight: 800; }
|
|
50
|
+
.project-meta { margin-top: .25rem; color: var(--muted); font-size: .8rem; }
|
|
51
|
+
.project-detail { padding: 1.5rem; outline: none; }
|
|
52
|
+
.detail-heading { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; padding-bottom: 1rem; border-bottom: 1px solid var(--line); }
|
|
53
|
+
.detail-heading h3 { margin: .2rem 0 0; font-size: 1.8rem; }
|
|
54
|
+
.freshness { padding: .3rem .55rem; border: 1px solid currentColor; font-size: .75rem; font-weight: 800; text-transform: uppercase; }
|
|
55
|
+
.freshness-current { color: var(--green); }
|
|
56
|
+
.freshness-stale { color: var(--amber); }
|
|
57
|
+
.evidence-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0; margin: 1rem 0; border: 1px solid var(--line); }
|
|
58
|
+
.evidence-row { min-width: 0; padding: .75rem; border-bottom: 1px solid var(--line); }
|
|
59
|
+
.evidence-row:nth-child(odd) { border-right: 1px solid var(--line); }
|
|
60
|
+
dt { color: var(--muted); font-size: .72rem; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; }
|
|
61
|
+
dd { margin: .25rem 0 0; overflow-wrap: anywhere; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .78rem; }
|
|
62
|
+
.detail-section { padding-top: 1rem; border-top: 1px solid var(--line); }
|
|
63
|
+
.detail-section h4 { margin: 0 0 .4rem; }
|
|
64
|
+
.attention-list { padding-left: 1.2rem; }
|
|
65
|
+
.muted, .empty-state, .message { color: var(--muted); }
|
|
66
|
+
.message { min-height: 1.5rem; }
|
|
67
|
+
.resource-registry { margin-top: 2rem; }
|
|
68
|
+
.resource-registry .section-heading p { max-width: 720px; margin: .35rem 0 0; color: var(--muted); }
|
|
69
|
+
.release-chain { display: flex; flex-wrap: wrap; align-items: center; gap: .55rem; margin-bottom: .75rem; padding: .8rem 1rem; border-left: 4px solid var(--green); background: #edf8f3; color: #154f3d; font-size: .78rem; }
|
|
70
|
+
.release-chain span { color: #708078; }
|
|
71
|
+
.resource-grid { display: grid; grid-template-columns: minmax(260px, .62fr) minmax(0, 1.38fr); min-height: 360px; border: 1px solid var(--line); background: var(--surface); }
|
|
72
|
+
@media (max-width: 760px) {
|
|
73
|
+
.masthead, .access-panel, .portfolio-grid, .resource-grid { display: block; }
|
|
74
|
+
.masthead { padding: 1.5rem 1.25rem; }
|
|
75
|
+
.service-state { margin-top: 1rem; }
|
|
76
|
+
main { width: min(100% - 1.5rem, 1180px); }
|
|
77
|
+
.access-panel form { margin-top: 1rem; }
|
|
78
|
+
.input-row { display: block; }
|
|
79
|
+
.input-row button { width: 100%; margin-top: .6rem; }
|
|
80
|
+
.authority-note { display: block; }
|
|
81
|
+
.section-heading { align-items: stretch; flex-direction: column; }
|
|
82
|
+
.section-heading button { width: 100%; white-space: normal; }
|
|
83
|
+
.detail-heading { flex-direction: column; }
|
|
84
|
+
.summary-grid { grid-template-columns: repeat(2, 1fr); }
|
|
85
|
+
.project-list { border-right: 0; border-bottom: 1px solid var(--line); }
|
|
86
|
+
.evidence-grid { grid-template-columns: 1fr; }
|
|
87
|
+
.evidence-row:nth-child(odd) { border-right: 0; }
|
|
88
|
+
.project-detail, .project-list, .resource-registry { min-width: 0; }
|
|
89
|
+
.project-name, .project-meta, .detail-section, .attention-list { overflow-wrap: anywhere; }
|
|
90
|
+
}
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
import { execFileSync } from 'node:child_process';
|
|
2
|
+
import { existsSync, lstatSync, mkdtempSync, readFileSync, rmSync } from 'node:fs';
|
|
3
|
+
import { tmpdir } from 'node:os';
|
|
4
|
+
import { dirname, isAbsolute, relative, resolve } from 'node:path';
|
|
5
|
+
import { fileURLToPath } from 'node:url';
|
|
6
|
+
|
|
7
|
+
const rules = [
|
|
8
|
+
['personal-path', /\/(?:Users|home)\/(?!you(?:\/|\b)|example(?:\/|\b)|username(?:\/|\b)|user(?:\/|\b))[^\s/"'`<>]+\//],
|
|
9
|
+
['internal-workspace', /(?:BusinessOps\/|\.claude\/projects\/|EngineeringWithAI\/Content\/Companion)/],
|
|
10
|
+
['development-endpoint', /\b(?:api|our)\.dev\.backstory\.is\b/i],
|
|
11
|
+
['internal-provenance', /\b(?:Added|Originally generated|Created from lessons|introduced|Last index refresh)\b[^\n]{0,140}\b20\d{2}-\d{2}-\d{2}\b/i],
|
|
12
|
+
['private-key', /-----BEGIN (?:RSA |EC |OPENSSH |DSA )?PRIVATE KEY-----/],
|
|
13
|
+
['github-token', /\b(?:gh[pousr]_[A-Za-z0-9]{25,}|github_pat_[A-Za-z0-9_]{30,})\b/],
|
|
14
|
+
['stripe-secret', /\b(?:sk|rk)_(?:live|test)_[A-Za-z0-9]{16,}\b/],
|
|
15
|
+
['aws-access-key', /\b(?:AKIA|ASIA)[A-Z0-9]{16}\b/],
|
|
16
|
+
['openai-key', /\bsk-(?:proj-)?[A-Za-z0-9_-]{30,}\b/],
|
|
17
|
+
['google-key', /\bAIza[A-Za-z0-9_-]{30,}\b/],
|
|
18
|
+
['npm-token', /\bnpm_[A-Za-z0-9]{30,}\b/],
|
|
19
|
+
['telegram-token', /\b\d{8,12}:[A-Za-z0-9_-]{30,}\b/],
|
|
20
|
+
['authenticated-url', /https?:\/\/[^\s/]+:[^\s/@]+@/],
|
|
21
|
+
];
|
|
22
|
+
|
|
23
|
+
function safePath(path) {
|
|
24
|
+
return typeof path === 'string' && path.length > 0 && !isAbsolute(path)
|
|
25
|
+
&& !path.includes('\\') && !/[\x00-\x1f]/.test(path)
|
|
26
|
+
&& !path.split('/').some(part => part === '..' || part === '.' || part === '');
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
function privateFile(path) {
|
|
30
|
+
if (/^\.ewai-pipeline\//.test(path)) return path !== '.ewai-pipeline/.gitignore';
|
|
31
|
+
if (/^(?:SPECS\/|src\/migration\/|packs\/personas\/premium\/)/.test(path)) return true;
|
|
32
|
+
if (/^config\/.*(?:source-manifest|migration-map|operation-parity)\.(?:json|ya?ml)$/.test(path)) return true;
|
|
33
|
+
if (/(?:^|\/)(?:\.env(?:\..+)?|\.npmrc|\.netrc|id_rsa|id_ed25519)$/.test(path)) {
|
|
34
|
+
return !/(?:^|\/)\.env\.(?:example|sample|template)$/.test(path);
|
|
35
|
+
}
|
|
36
|
+
return /\.(?:pem|key|p12|pfx|sqlite|sqlite3|db|sql|har|log|zip|tgz)$/i.test(path);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export function publicationIssues(path, content) {
|
|
40
|
+
if (!safePath(path)) return [{ file: '[unsafe path]', line: 0, category: 'unsafe-path' }];
|
|
41
|
+
const findings = privateFile(path) ? [{ file: path, line: 0, category: 'private-file' }] : [];
|
|
42
|
+
for (const [index, line] of String(content).split('\n').entries()) {
|
|
43
|
+
for (const [category, expression] of rules) {
|
|
44
|
+
if (expression.test(line)) findings.push({ file: path, line: index + 1, category });
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
return findings;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export function scanPublicationFiles(root, paths) {
|
|
51
|
+
const findings = [];
|
|
52
|
+
for (const path of [...new Set(paths)].sort()) {
|
|
53
|
+
if (!safePath(path)) {
|
|
54
|
+
findings.push(...publicationIssues(path, ''));
|
|
55
|
+
continue;
|
|
56
|
+
}
|
|
57
|
+
const absolute = resolve(root, path);
|
|
58
|
+
if (relative(resolve(root), absolute).startsWith('..')) {
|
|
59
|
+
findings.push({ file: '[unsafe path]', line: 0, category: 'unsafe-path' });
|
|
60
|
+
continue;
|
|
61
|
+
}
|
|
62
|
+
try {
|
|
63
|
+
const components = path.split('/');
|
|
64
|
+
let candidate = resolve(root);
|
|
65
|
+
let linked = false;
|
|
66
|
+
for (const component of components) {
|
|
67
|
+
candidate = resolve(candidate, component);
|
|
68
|
+
if (lstatSync(candidate).isSymbolicLink()) { linked = true; break; }
|
|
69
|
+
}
|
|
70
|
+
if (linked) {
|
|
71
|
+
findings.push({ file: path, line: 0, category: 'symlink' });
|
|
72
|
+
continue;
|
|
73
|
+
}
|
|
74
|
+
const stat = lstatSync(absolute);
|
|
75
|
+
if (!stat.isFile() || stat.size > 8 * 1024 * 1024) {
|
|
76
|
+
findings.push({ file: path, line: 0, category: 'unscannable-file' });
|
|
77
|
+
continue;
|
|
78
|
+
}
|
|
79
|
+
const pathIssues = publicationIssues(path, '');
|
|
80
|
+
if (pathIssues.length) { findings.push(...pathIssues); continue; }
|
|
81
|
+
findings.push(...publicationIssues(path, readFileSync(absolute).toString('utf8')));
|
|
82
|
+
} catch (error) {
|
|
83
|
+
findings.push({ file: path, line: 0, category: error.code === 'ENOENT' ? 'missing-file' : 'unreadable-file' });
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
return findings;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
function repositoryCandidates(root) {
|
|
90
|
+
const listed = execFileSync('git', ['ls-files', '--cached', '--others', '--exclude-standard', '-z'], {
|
|
91
|
+
cwd: root, encoding: 'utf8', stdio: ['ignore', 'pipe', 'pipe'],
|
|
92
|
+
}).split('\0').filter(Boolean);
|
|
93
|
+
return [...new Set(listed)].filter(path => {
|
|
94
|
+
try { lstatSync(resolve(root, path)); return true; }
|
|
95
|
+
catch (error) { return error.code !== 'ENOENT'; }
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
export function checkPublication(root, { sourceOnly = false } = {}) {
|
|
100
|
+
const source = repositoryCandidates(root);
|
|
101
|
+
const findings = scanPublicationFiles(root, source);
|
|
102
|
+
let packedFiles = 0;
|
|
103
|
+
if (!sourceOnly) {
|
|
104
|
+
const cache = mkdtempSync(resolve(tmpdir(), 'ewai-publication-cache-'));
|
|
105
|
+
try {
|
|
106
|
+
const result = execFileSync('npm', ['pack', '--dry-run', '--json', '--ignore-scripts'], {
|
|
107
|
+
cwd: root, encoding: 'utf8', stdio: ['ignore', 'pipe', 'pipe'], timeout: 60_000,
|
|
108
|
+
env: { ...process.env, npm_config_cache: cache, npm_config_update_notifier: 'false' },
|
|
109
|
+
});
|
|
110
|
+
const manifest = JSON.parse(result);
|
|
111
|
+
if (!Array.isArray(manifest) || manifest.length !== 1 || !Array.isArray(manifest[0].files) || !manifest[0].files.length) {
|
|
112
|
+
throw new Error('Invalid package manifest');
|
|
113
|
+
}
|
|
114
|
+
const paths = manifest[0].files.map(file => file.path);
|
|
115
|
+
if (paths.some(path => typeof path !== 'string')) throw new Error('Invalid package path');
|
|
116
|
+
packedFiles = paths.length;
|
|
117
|
+
findings.push(...scanPublicationFiles(root, paths));
|
|
118
|
+
} catch {
|
|
119
|
+
findings.push({ file: 'package.json', line: 0, category: 'package-inspection-failed' });
|
|
120
|
+
} finally {
|
|
121
|
+
rmSync(cache, { recursive: true, force: true });
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
const unique = [...new Map(findings.map(finding => [JSON.stringify(finding), finding])).values()];
|
|
125
|
+
return { status: unique.length ? 'fail' : 'pass', sourceFiles: source.length, packedFiles, findings: unique };
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
if (process.argv[1] && resolve(process.argv[1]) === fileURLToPath(import.meta.url)) {
|
|
129
|
+
const selected = process.argv.indexOf('--project');
|
|
130
|
+
const root = selected < 0 ? resolve(dirname(fileURLToPath(import.meta.url)), '..') : resolve(process.argv[selected + 1] ?? '.');
|
|
131
|
+
const quiet = process.argv.includes('--quiet');
|
|
132
|
+
try {
|
|
133
|
+
const result = checkPublication(root, { sourceOnly: process.argv.includes('--source-only') });
|
|
134
|
+
if (!quiet || result.status !== 'pass') (quiet ? console.error : console.log)(JSON.stringify(result));
|
|
135
|
+
process.exitCode = result.status === 'pass' ? 0 : 1;
|
|
136
|
+
} catch {
|
|
137
|
+
(quiet ? console.error : console.log)(JSON.stringify({ status: 'fail', findings: [{ file: '[repository]', line: 0, category: 'source-inspection-failed' }] }));
|
|
138
|
+
process.exitCode = 1;
|
|
139
|
+
}
|
|
140
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { resolve } from 'node:path';
|
|
3
|
+
import { install } from '../src/install.mjs';
|
|
4
|
+
|
|
5
|
+
const args = process.argv.slice(2);
|
|
6
|
+
|
|
7
|
+
function option(name, fallback = '') {
|
|
8
|
+
const index = args.indexOf(name);
|
|
9
|
+
return index === -1 ? fallback : args[index + 1] ?? fallback;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
const project = option('--project');
|
|
13
|
+
const result = install({
|
|
14
|
+
scope: project ? 'project' : 'global',
|
|
15
|
+
projectRoot: project ? resolve(project) : '',
|
|
16
|
+
host: option('--host', 'auto'),
|
|
17
|
+
mode: option('--mode', project ? 'copy' : 'link'),
|
|
18
|
+
force: args.includes('--force')
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
console.log(JSON.stringify(result, null, 2));
|