@piecemaker-legal/piecemaker 2.0.8 → 2.0.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/FindReplaceDialog-KU5TEIBJ-CQ76sPaJ.js +1 -0
- package/dist/assets/FootnotePropertiesDialog-W3YHM4BV-BpgYQvvd.js +1 -0
- package/dist/assets/HyperlinkDialog-ZYH7ZHRF-qIPBOssF.css +1 -0
- package/dist/assets/HyperlinkDialog-ZYH7ZHRF-z08UbYbL.js +144 -0
- package/dist/assets/ImagePositionDialog-HEWYR6Q3-CFzOnzAt.js +1 -0
- package/dist/assets/ImagePropertiesDialog-RAB47C6M-D-ThGU-b.js +1 -0
- package/dist/assets/PageSetupDialog-AIGIXO3E-_PYIO8eb.js +1 -0
- package/dist/assets/SplitCellDialog-IFBKYCD6-Cb9uQOB8.js +1 -0
- package/dist/assets/TablePropertiesDialog-TMLKGOOW-12vmjb6B.js +1 -0
- package/dist/assets/WatermarkDialog-KRL7WMIS-C-d8rzt2.js +1 -0
- package/dist/assets/{abnfDiagram-VCTEODGH-XuFdW3jA.js → abnfDiagram-VCTEODGH-B4OsX7eF.js} +1 -1
- package/dist/assets/arc-BK1oUIk7.js +1 -0
- package/dist/assets/architectureDiagram-5GKGNRK7-CfaFI6L7.js +36 -0
- package/dist/assets/{blockDiagram-I7D4REHJ-CsgOSDLB.js → blockDiagram-I7D4REHJ-DQEI2azY.js} +1 -1
- package/dist/assets/{c4Diagram-7LVT6UL2-awKtsGCB.js → c4Diagram-7LVT6UL2-DbravpVi.js} +1 -1
- package/dist/assets/channel-DVyNr2Yg.js +1 -0
- package/dist/assets/{chunk-2Q5K7J3B-DA5F8ig-.js → chunk-2Q5K7J3B-BLpZ9huC.js} +1 -1
- package/dist/assets/{chunk-5VM5RSS4-DawRFEGW.js → chunk-5VM5RSS4-BLlEdmX9.js} +1 -1
- package/dist/assets/{chunk-F27PBJKO-BO6B_U1p.js → chunk-F27PBJKO-D-ZNhI6q.js} +1 -1
- package/dist/assets/{chunk-IMKFNOWR-Dhrf_k6W.js → chunk-IMKFNOWR-vzSiKnhh.js} +1 -1
- package/dist/assets/{chunk-JWPE2WC7-BTGX4CJ7.js → chunk-JWPE2WC7-DfF0k4nb.js} +1 -1
- package/dist/assets/{chunk-POPQ4Y6H-ByKLZ0wa.js → chunk-POPQ4Y6H-BnwCYsPP.js} +1 -1
- package/dist/assets/{chunk-SVP7TREG-DNCtUeow.js → chunk-SVP7TREG-DRxc8fhq.js} +1 -1
- package/dist/assets/{chunk-TICWLB2K-bgcAtBKw.js → chunk-TICWLB2K-Dd2Q-md-.js} +1 -1
- package/dist/assets/{chunk-XXDRQBXY-AD-pwqOj.js → chunk-XXDRQBXY-DBjkEUp_.js} +1 -1
- package/dist/assets/classDiagram-ZZMXUADV-2pGPHl5H.js +1 -0
- package/dist/assets/classDiagram-v2-VYDZK3BY-2pGPHl5H.js +1 -0
- package/dist/assets/{cose-bilkent-JH36ORCC-D23VMTjy.js → cose-bilkent-JH36ORCC-By6PS4oe.js} +1 -1
- package/dist/assets/{cynefin-OW5HDTMX-thDLtHBg.js → cynefin-OW5HDTMX-YxWpjc5W.js} +1 -1
- package/dist/assets/{cynefinDiagram-5FMLGOSQ-BTG5qDGi.js → cynefinDiagram-5FMLGOSQ-DrtXzz3p.js} +1 -1
- package/dist/assets/{dagre-GXQ25YYZ-yXAeLV32.js → dagre-GXQ25YYZ-BDpTLKqZ.js} +1 -1
- package/dist/assets/{diagram-S7CK7UJ4-v1-YDY3c.js → diagram-S7CK7UJ4-C4LvqeCs.js} +1 -1
- package/dist/assets/{diagram-UQ7AKVKN-DlO9hQ63.js → diagram-UQ7AKVKN-BTpnMeHp.js} +1 -1
- package/dist/assets/{diagram-VSXAHHWV-B3Bz2C6Y.js → diagram-VSXAHHWV-DucHHWev.js} +1 -1
- package/dist/assets/{diagram-VX7I27RA-BosIgZRa.js → diagram-VX7I27RA-DYHZNmmH.js} +1 -1
- package/dist/assets/{diagram-Z3DM3KII-C1MFbIji.js → diagram-Z3DM3KII-BHIH2BGN.js} +1 -1
- package/dist/assets/{ebnfDiagram-PWID7BFC-B6g9aRAb.js → ebnfDiagram-PWID7BFC-CGiEkwj0.js} +1 -1
- package/dist/assets/{erDiagram-RLTQ6QDP-BuV5RUQ-.js → erDiagram-RLTQ6QDP-AJMHi2Us.js} +1 -1
- package/dist/assets/{flowDiagram-HODETNUW-OFcS8Psg.js → flowDiagram-HODETNUW-BqzANBh2.js} +1 -1
- package/dist/assets/{ganttDiagram-EL5Y4UJY-CxCIs-y4.js → ganttDiagram-EL5Y4UJY-B0xPDY2_.js} +1 -1
- package/dist/assets/{gitGraphDiagram-WWUBYQGX-DQHfgTRq.js → gitGraphDiagram-WWUBYQGX-CzPX5CNO.js} +1 -1
- package/dist/assets/{index-BPmxqMd5.js → index-Bk2iXKnJ.js} +140 -140
- package/dist/assets/index-Dc9wNuS4.css +1 -0
- package/dist/assets/{infoDiagram-27XIBGKW-UvDaFHGE.js → infoDiagram-27XIBGKW-Cjc44H0O.js} +1 -1
- package/dist/assets/{ishikawaDiagram-5VMMS53U-B04u_588.js → ishikawaDiagram-5VMMS53U-BWhr2v7r.js} +1 -1
- package/dist/assets/{journeyDiagram-3NMN7TZE-BYvBbjXl.js → journeyDiagram-3NMN7TZE-Bl4r6RrP.js} +1 -1
- package/dist/assets/{kanban-definition-UXKFOSKX-DxAJd2LW.js → kanban-definition-UXKFOSKX-FV-T0Vy1.js} +6 -6
- package/dist/assets/layout-CTfb1sAF.js +1 -0
- package/dist/assets/{linear-CmWY0F-m.js → linear-Dfgi6vlo.js} +1 -1
- package/dist/assets/{mermaid.core-ClUcKNvb.js → mermaid.core-DOCGsdlo.js} +7 -7
- package/dist/assets/{mindmap-definition-YA3MSWOX-DZ2GO-J-.js → mindmap-definition-YA3MSWOX-CymQ86ir.js} +1 -1
- package/dist/assets/{pegDiagram-XKGWAZYB-DF4i_o7r.js → pegDiagram-XKGWAZYB-1VMq_vi0.js} +1 -1
- package/dist/assets/{pieDiagram-E7YTZNPT-G20Z0KTO.js → pieDiagram-E7YTZNPT-C5GgXtJU.js} +1 -1
- package/dist/assets/processTemplate-GPFDLQMX-B1sVV2O0.js +22 -0
- package/dist/assets/{quadrantDiagram-AXDQQJYC-5MRlN0BO.js → quadrantDiagram-AXDQQJYC-C6zpryYf.js} +1 -1
- package/dist/assets/{railroadDiagram-O6MQD6OU-B4Fp-guo.js → railroadDiagram-O6MQD6OU-D-sv4SWi.js} +1 -1
- package/dist/assets/{requirementDiagram-BXWQKSXE-DFL0eww_.js → requirementDiagram-BXWQKSXE-CkjY-z4B.js} +1 -1
- package/dist/assets/sankeyDiagram-P5KCCOFB-De-d8Q6L.js +40 -0
- package/dist/assets/{sequenceDiagram-WJ2MYXX4-iP9OUxwi.js → sequenceDiagram-WJ2MYXX4-DCsGSJa9.js} +1 -1
- package/dist/assets/{server.browser-BzI1jrZw.js → server.browser-BY3bL-IX.js} +1 -1
- package/dist/assets/{sizeCapture-INFHLROL-C95kgcA-.js → sizeCapture-INFHLROL-xINZhgER.js} +1 -1
- package/dist/assets/stateDiagram-D77RDMKH-CuLUTWSL.js +1 -0
- package/dist/assets/stateDiagram-v2-MP3YSRHH-Cnbs-M92.js +1 -0
- package/dist/assets/{swimlanes-42K2YHIH-BbMY7ECY.js → swimlanes-42K2YHIH-BwxARD7N.js} +1 -1
- package/dist/assets/swimlanesDiagram-VR7AAH4N-D7p8qZI2.js +8 -0
- package/dist/assets/{timeline-definition-24CTP7MA-BQs8wPer.js → timeline-definition-24CTP7MA-BIOvnn-l.js} +3 -3
- package/dist/assets/{vendor-codemirror-CjW0lHR5.js → vendor-codemirror-CN-sJePf.js} +2 -2
- package/dist/assets/{vendor-react-D809iwXR.js → vendor-react-B22wqN3J.js} +5 -5
- package/dist/assets/{vennDiagram-4TSXK5OY-Imm0EPbt.js → vennDiagram-4TSXK5OY-BSD6Pfmt.js} +4 -4
- package/dist/assets/{wardleyDiagram-VM6X3IG4-DpMMDayn.js → wardleyDiagram-VM6X3IG4-7Zz2iRkF.js} +1 -1
- package/dist/assets/{xychartDiagram-S5SC5T6Z-DdLp1sYL.js → xychartDiagram-S5SC5T6Z-Ctx17Y1D.js} +1 -1
- package/dist/index.html +4 -4
- package/dist/sw.js +1 -1
- package/dist-server/server/modules/providers/list/mistral/mistral-models.provider.js +4 -53
- package/dist-server/server/modules/providers/list/mistral/mistral-models.provider.js.map +1 -1
- package/dist-server/server/modules/providers/list/mistral/mistral-runtime.provider.js +2 -3
- package/dist-server/server/modules/providers/list/mistral/mistral-runtime.provider.js.map +1 -1
- package/dist-server/server/modules/providers/list/mistral/mistral-vibe-models.js +30 -0
- package/dist-server/server/modules/providers/list/mistral/mistral-vibe-models.js.map +1 -0
- package/dist-server/server/modules/providers/tests/mistral-vibe-models.test.js +24 -0
- package/dist-server/server/modules/providers/tests/mistral-vibe-models.test.js.map +1 -0
- package/dist-server/server/piecemaker/anonymizer/lifecycle.js +2 -3
- package/dist-server/server/piecemaker/anonymizer/lifecycle.js.map +1 -1
- package/dist-server/server/piecemaker/desktop-update/index.js +4 -3
- package/dist-server/server/piecemaker/desktop-update/index.js.map +1 -1
- package/dist-server/server/piecemaker/docx-document.js +50 -0
- package/dist-server/server/piecemaker/docx-document.js.map +1 -0
- package/dist-server/server/piecemaker/index.js +9 -2
- package/dist-server/server/piecemaker/index.js.map +1 -1
- package/dist-server/server/piecemaker/model-discovery/codex-catalog.js +46 -0
- package/dist-server/server/piecemaker/model-discovery/codex-catalog.js.map +1 -0
- package/dist-server/server/piecemaker/model-discovery/index.js +42 -0
- package/dist-server/server/piecemaker/model-discovery/index.js.map +1 -0
- package/dist-server/server/piecemaker/model-discovery/mistral-catalog.js +19 -0
- package/dist-server/server/piecemaker/model-discovery/mistral-catalog.js.map +1 -0
- package/dist-server/server/piecemaker/model-discovery/stdio-rpc.js +61 -0
- package/dist-server/server/piecemaker/model-discovery/stdio-rpc.js.map +1 -0
- package/dist-server/server/piecemaker/project-registry.js +29 -0
- package/dist-server/server/piecemaker/project-registry.js.map +1 -0
- package/package.json +12 -1
- package/scripts/piecemaker/cli/disable-anonymizer.mjs +19 -0
- package/scripts/piecemaker/cli/lib/config.mjs +0 -1
- package/scripts/piecemaker/cli/lib/services.mjs +1 -10
- package/scripts/piecemaker/cli/piecemaker.mjs +0 -3
- package/server/modules/providers/list/mistral/mistral-models.provider.ts +4 -53
- package/server/modules/providers/list/mistral/mistral-runtime.provider.ts +2 -3
- package/server/modules/providers/list/mistral/mistral-vibe-models.ts +43 -0
- package/server/modules/providers/tests/mistral-vibe-models.test.ts +27 -0
- package/server/piecemaker/anonymizer/client-config.cjs +92 -92
- package/server/piecemaker/anonymizer/hudsucker-fixture.cjs +9 -16
- package/server/piecemaker/anonymizer/hudsucker-proxy/Cargo.toml +1 -1
- package/server/piecemaker/anonymizer/hudsucker-proxy/src/main.rs +251 -268
- package/server/piecemaker/anonymizer/lifecycle.ts +2 -3
- package/server/piecemaker/anonymizer/rewriter-bridge.cjs +6 -0
- package/server/piecemaker/anonymizer/service.cjs +117 -175
- package/server/piecemaker/desktop-update/index.ts +4 -3
- package/server/piecemaker/docx-document.ts +54 -0
- package/server/piecemaker/harness/decisions.cjs +1 -1
- package/server/piecemaker/harness/index.cjs +2 -3
- package/server/piecemaker/harness/verification.cjs +1 -1
- package/server/piecemaker/index.ts +11 -3
- package/server/piecemaker/model-discovery/codex-catalog.ts +67 -0
- package/server/piecemaker/model-discovery/index.ts +69 -0
- package/server/piecemaker/model-discovery/mistral-catalog.ts +36 -0
- package/server/piecemaker/model-discovery/stdio-rpc.ts +79 -0
- package/server/piecemaker/project-registry.ts +34 -0
- package/server/piecemaker/router.cjs +6 -7
- package/server/piecemaker/vendor/installer/bin/piecemaker.mjs +31 -77
- package/server/piecemaker/vendor/installer/lib/codex-skills.mjs +2 -84
- package/server/piecemaker/vendor/installer/lib/service.mjs +4 -24
- package/server/piecemaker/vendor/installer/steps/06-hooks.mjs +10 -21
- package/server/piecemaker/vendor/installer/steps/09-claude-assets.mjs +0 -11
- package/server/piecemaker/vendor/installer/steps/09-codex-plugin.mjs +6 -36
- package/server/piecemaker/vendor/installer/steps/13-garde-secrets.mjs +30 -12
- package/server/piecemaker/vendor/piecemaker-plugin/README.md +2 -9
- package/server/piecemaker/vendor/piecemaker-plugin/scripts/billing-track.mjs +5 -5
- package/server/piecemaker/vendor/piecemaker-plugin/scripts/classify-ai-documents.mjs +8 -8
- package/server/piecemaker/vendor/piecemaker-plugin/scripts/commit-track.mjs +2 -2
- package/server/piecemaker/vendor/piecemaker-plugin/scripts/compile-recherche.mjs +4 -6
- package/server/piecemaker/vendor/piecemaker-plugin/scripts/lib/case-folders.cjs +71 -38
- package/server/piecemaker/vendor/piecemaker-plugin/scripts/lib/mapping.cjs +8 -38
- package/server/piecemaker/vendor/piecemaker-plugin/scripts/lib/protection.cjs +82 -61
- package/server/piecemaker/vendor/piecemaker-plugin/scripts/protect-originals.mjs +4 -55
- package/server/piecemaker/vendor/piecemaker-plugin/scripts/statusline.mjs +24 -117
- package/server/piecemaker/vendor/piecemaker-plugin/skills/tamponnage/SKILL.md +2 -2
- package/server/piecemaker/vendor/websocket-server/admin-routes.cjs +15 -121
- package/server/piecemaker/vendor/websocket-server/case-registry.cjs +16 -32
- package/server/piecemaker/vendor/websocket-server/claude-hooks.cjs +0 -73
- package/server/piecemaker/vendor/websocket-server/originals-pipeline.cjs +0 -7
- package/server/piecemaker/vendor/websocket-server/scripts/presidio-gliner/scanner_worker.py +2 -0
- package/server/piecemaker/vendor/websocket-server/stamping-routes.cjs +3 -12
- package/server/piecemaker/vendor/websocket-server/workspace-paths.cjs +6 -6
- package/dist/assets/arc-CsCtfL20.js +0 -1
- package/dist/assets/architectureDiagram-5GKGNRK7-DGxozBGS.js +0 -36
- package/dist/assets/channel-DnynWwYa.js +0 -1
- package/dist/assets/classDiagram-ZZMXUADV-CHIsGj2B.js +0 -1
- package/dist/assets/classDiagram-v2-VYDZK3BY-CHIsGj2B.js +0 -1
- package/dist/assets/index-WwknP0l4.css +0 -1
- package/dist/assets/layout-R7w2kLxO.js +0 -1
- package/dist/assets/sankeyDiagram-P5KCCOFB-CpOdmqdy.js +0 -40
- package/dist/assets/stateDiagram-D77RDMKH-D9WHRvlY.js +0 -1
- package/dist/assets/stateDiagram-v2-MP3YSRHH-D9Qlflkb.js +0 -1
- package/dist/assets/swimlanesDiagram-VR7AAH4N-CA64dwpM.js +0 -8
- package/scripts/piecemaker/cli/lib/piecemaker-anonymizer.mjs +0 -78
- package/scripts/piecemaker/hooks/proxy-guard.mjs +0 -251
- package/server/piecemaker/anonymizer/providers.cjs +0 -120
- package/server/piecemaker/vendor/installer/steps/08-telegram.mjs +0 -482
- package/server/piecemaker/vendor/piecemaker-plugin/scripts/lib/central-mapping.cjs +0 -0
- package/server/piecemaker/vendor/websocket-server/telegram-admin.cjs +0 -602
|
@@ -17,16 +17,14 @@ import os from 'node:os';
|
|
|
17
17
|
import path from 'node:path';
|
|
18
18
|
import { createRequire } from 'node:module';
|
|
19
19
|
import { log, spinner } from '../lib/ui.mjs';
|
|
20
|
-
import { REPO_ROOT,
|
|
20
|
+
import { REPO_ROOT, HOME_DIR, runCapture, ensureDir } from '../lib/platform.mjs';
|
|
21
21
|
import { updateConfig } from '../lib/state.mjs';
|
|
22
22
|
|
|
23
23
|
const require = createRequire(import.meta.url);
|
|
24
24
|
const {
|
|
25
25
|
claudeHooksStatus,
|
|
26
|
-
claudeSessionHookStatus,
|
|
27
26
|
claudeStatusLineStatus,
|
|
28
27
|
installClaudeHooks,
|
|
29
|
-
installClaudeSessionHook,
|
|
30
28
|
installClaudeStatusLine,
|
|
31
29
|
} = require('../../websocket-server/claude-hooks.cjs');
|
|
32
30
|
|
|
@@ -47,7 +45,6 @@ const HOOK_SCRIPTS = {
|
|
|
47
45
|
commit: path.join(SCRIPTS_DIR, 'commit-track.mjs'),
|
|
48
46
|
classify: path.join(SCRIPTS_DIR, 'classify-ai-documents.mjs'),
|
|
49
47
|
billing: path.join(SCRIPTS_DIR, 'billing-track.mjs'),
|
|
50
|
-
proxyGuard: path.join(GIT_REPO_ROOT, 'scripts', 'piecemaker', 'hooks', 'proxy-guard.mjs'),
|
|
51
48
|
statusline: path.join(SCRIPTS_DIR, 'statusline.mjs'),
|
|
52
49
|
};
|
|
53
50
|
|
|
@@ -106,16 +103,16 @@ export async function install(ctx) {
|
|
|
106
103
|
const testResults = [];
|
|
107
104
|
let testDir = null;
|
|
108
105
|
let selftestRegistered = false;
|
|
109
|
-
const
|
|
106
|
+
const { publishProjectSource } = require('../../piecemaker-plugin/scripts/lib/case-folders.cjs');
|
|
110
107
|
|
|
111
108
|
try {
|
|
112
109
|
// Un vrai dossier juridique factice, sans point de tête : les hooks
|
|
113
110
|
// ignorent les répertoires cachés, un bac de test caché ne prouverait donc
|
|
114
|
-
// rien du garde-fou. Comme un
|
|
115
|
-
// on
|
|
111
|
+
// rien du garde-fou. Comme seul un projet publié est un dossier juridique,
|
|
112
|
+
// on le publie le temps du test sous une source dédiée, retirée ensuite.
|
|
116
113
|
testDir = fs.realpathSync(fs.mkdtempSync(path.join(os.tmpdir(), 'piecemaker-hook-selftest-')));
|
|
117
114
|
fs.writeFileSync(path.join(testDir, 'piece-selftest.pdf'), 'PIECE DE TEST', 'utf8');
|
|
118
|
-
|
|
115
|
+
publishProjectSource('installer-selftest', [testDir]);
|
|
119
116
|
selftestRegistered = true;
|
|
120
117
|
|
|
121
118
|
// 1. protect-originals.mjs — une pièce du bac de test : protégée par
|
|
@@ -165,8 +162,8 @@ export async function install(ctx) {
|
|
|
165
162
|
// de test enregistré doit ressortir classé « espace de travail » dans
|
|
166
163
|
// `.piecemaker/protection.json`, sans quoi l'IA ne pourrait pas se
|
|
167
164
|
// relire. On vérifie l'effet de bord, pas seulement le code de sortie.
|
|
168
|
-
const createdDoc = path.join(testDir, 'note-selftest.
|
|
169
|
-
fs.writeFileSync(createdDoc, 'NOTE DE TEST', 'utf8');
|
|
165
|
+
const createdDoc = path.join(testDir, 'note-selftest.pdf');
|
|
166
|
+
fs.writeFileSync(createdDoc, '%PDF-1.4 NOTE DE TEST', 'utf8');
|
|
170
167
|
const classifyResult = runHookSelfTest('classify-ai-documents.mjs', HOOK_SCRIPTS.classify, {
|
|
171
168
|
hook_event_name: 'PostToolUse',
|
|
172
169
|
session_id: 'installer-selftest',
|
|
@@ -180,7 +177,7 @@ export async function install(ctx) {
|
|
|
180
177
|
});
|
|
181
178
|
if (classifyResult.ok) {
|
|
182
179
|
const { readProtection } = require('../../piecemaker-plugin/scripts/lib/protection.cjs');
|
|
183
|
-
if (!readProtection(testDir).unprotected.has('note-selftest.
|
|
180
|
+
if (!readProtection(testDir).unprotected.has('note-selftest.pdf')) {
|
|
184
181
|
classifyResult.ok = false;
|
|
185
182
|
classifyResult.note = 'le document créé n\'a pas été classé « espace de travail »';
|
|
186
183
|
} else {
|
|
@@ -191,7 +188,7 @@ export async function install(ctx) {
|
|
|
191
188
|
} finally {
|
|
192
189
|
// Rétablir la liste des dossiers enregistrés : le bac de test ne doit pas
|
|
193
190
|
// rester surveillé après l'installation.
|
|
194
|
-
if (selftestRegistered)
|
|
191
|
+
if (selftestRegistered) publishProjectSource('installer-selftest', null);
|
|
195
192
|
if (testDir) fs.rmSync(testDir, { recursive: true, force: true });
|
|
196
193
|
}
|
|
197
194
|
|
|
@@ -223,13 +220,6 @@ export async function install(ctx) {
|
|
|
223
220
|
}
|
|
224
221
|
log.ok(`${registration.registered} hook(s) PieceMaker ${registration.changed ? 'enregistré(s)' : 'déjà enregistré(s)'} directement dans ~/.claude/settings.json.`);
|
|
225
222
|
|
|
226
|
-
const sessionHook = installClaudeSessionHook(os.homedir());
|
|
227
|
-
if (!sessionHook.ok) {
|
|
228
|
-
log.warn(`Sentinelle proxy PII (SessionStart) non enregistrée : ${sessionHook.reason}.`);
|
|
229
|
-
} else {
|
|
230
|
-
log.ok(`Sentinelle proxy PII (SessionStart) ${sessionHook.changed ? 'enregistrée' : 'déjà à jour'} dans ~/.claude/settings.json.`);
|
|
231
|
-
}
|
|
232
|
-
|
|
233
223
|
const statusLine = installClaudeStatusLine(REPO_ROOT, os.homedir());
|
|
234
224
|
if (statusLine.conflict) {
|
|
235
225
|
log.warn(`statusLine Claude Code personnelle détectée — laissée telle quelle (${statusLine.reason}). Bandeau d'état PieceMaker non installé.`);
|
|
@@ -249,14 +239,13 @@ export async function check(ctx) {
|
|
|
249
239
|
const cfg = ctx.config || {};
|
|
250
240
|
const configOk = Boolean(cfg.commits && cfg.billing);
|
|
251
241
|
const hooksRegistered = claudeHooksStatus(REPO_ROOT, os.homedir()).ok;
|
|
252
|
-
const sessionHookRegistered = claudeSessionHookStatus(os.homedir()).ok;
|
|
253
242
|
const statusLine = claudeStatusLineStatus(REPO_ROOT, os.homedir());
|
|
254
243
|
const statusLineOk = statusLine.ok || statusLine.conflict; // une statusLine personnelle n'est pas une anomalie
|
|
255
244
|
|
|
256
245
|
if (!scriptsExist || !hooksJsonExists) {
|
|
257
246
|
return { status: 'failed', note: 'Fichiers du plugin manquants (scripts ou hooks.json) — réinstallez piecemaker-plugin/.' };
|
|
258
247
|
}
|
|
259
|
-
if (!dirsExist || !configOk || !hooksRegistered
|
|
248
|
+
if (!dirsExist || !configOk || !hooksRegistered) {
|
|
260
249
|
return { status: 'partial', note: 'Scripts présents mais configuration, enregistrement Claude ou répertoires de facturation incomplets — relancez cette étape.' };
|
|
261
250
|
}
|
|
262
251
|
if (!statusLineOk) {
|
|
@@ -13,12 +13,10 @@ import { createRequire } from 'node:module';
|
|
|
13
13
|
|
|
14
14
|
import { log } from '../lib/ui.mjs';
|
|
15
15
|
import { REPO_ROOT, commandExists } from '../lib/platform.mjs';
|
|
16
|
-
import { loadConfig } from '../lib/state.mjs';
|
|
17
16
|
|
|
18
17
|
const require = createRequire(import.meta.url);
|
|
19
18
|
const { claudeAssetStatus, repositoryAssets, syncClaudeAssets } = require('../../websocket-server/claude-assets.cjs');
|
|
20
19
|
const { claudeHooksStatus, installClaudeHooks } = require('../../websocket-server/claude-hooks.cjs');
|
|
21
|
-
const { refreshRegisteredCaseRules } = require('../../websocket-server/case-instructions.cjs');
|
|
22
20
|
|
|
23
21
|
export const meta = {
|
|
24
22
|
id: '09-claude-assets',
|
|
@@ -39,8 +37,6 @@ function dependencies(overrides = {}) {
|
|
|
39
37
|
syncClaudeAssets,
|
|
40
38
|
claudeHooksStatus,
|
|
41
39
|
installClaudeHooks,
|
|
42
|
-
loadConfig,
|
|
43
|
-
refreshRegisteredCaseRules,
|
|
44
40
|
...overrides,
|
|
45
41
|
};
|
|
46
42
|
}
|
|
@@ -64,7 +60,6 @@ export async function install(ctx, overrides = {}) {
|
|
|
64
60
|
if (ctx.dryRun) {
|
|
65
61
|
ops.log.info(`[simulation] enregistrement de ${assets.length} skill(s)/agent(s) PieceMaker dans ~/.claude`);
|
|
66
62
|
ops.log.info('[simulation] fusion des hooks PieceMaker dans ~/.claude/settings.json');
|
|
67
|
-
ops.log.info('[simulation] actualisation des instructions des dossiers juridiques enregistrés');
|
|
68
63
|
return { status: 'skipped', note: 'Mode simulation — aucune modification effectuée.' };
|
|
69
64
|
}
|
|
70
65
|
|
|
@@ -79,12 +74,6 @@ export async function install(ctx, overrides = {}) {
|
|
|
79
74
|
}
|
|
80
75
|
ops.log.detail(`${hooks.registered} hook(s) PieceMaker enregistré(s) directement dans ~/.claude/settings.json.`);
|
|
81
76
|
|
|
82
|
-
const instructions = ops.refreshRegisteredCaseRules(REPO_ROOT, ops.loadConfig());
|
|
83
|
-
ops.log.detail(`${instructions.refreshed} dossier(s) juridique(s) muni(s) des instructions PieceMaker.`);
|
|
84
|
-
for (const failure of instructions.failed) {
|
|
85
|
-
ops.log.warn(`Instructions non actualisées pour ${failure.folder} : ${failure.error}`);
|
|
86
|
-
}
|
|
87
|
-
|
|
88
77
|
if (result.conflicts.length) {
|
|
89
78
|
return {
|
|
90
79
|
status: 'partial',
|
|
@@ -2,35 +2,28 @@
|
|
|
2
2
|
* Étape 09 — composants PieceMaker pour la CLI Codex.
|
|
3
3
|
*
|
|
4
4
|
* Aucune entrée de marketplace ni aucun plugin d'application n'est créé :
|
|
5
|
-
* les skills sont enregistrés dans `~/.codex/skills/` et la
|
|
6
|
-
*
|
|
5
|
+
* les skills sont enregistrés dans `~/.codex/skills/` et la protection des
|
|
6
|
+
* pièces dans `~/.codex/hooks.json`, deux emplacements locaux découverts par
|
|
7
7
|
* la CLI Codex. Claude Code et son marketplace restent entièrement inchangés.
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
import fs from 'node:fs';
|
|
11
11
|
import os from 'node:os';
|
|
12
12
|
import path from 'node:path';
|
|
13
|
-
import { createRequire } from 'node:module';
|
|
14
13
|
import { log } from '../lib/ui.mjs';
|
|
15
14
|
import { REPO_ROOT, commandExists } from '../lib/platform.mjs';
|
|
16
15
|
import {
|
|
17
16
|
codexProtectionHookStatus,
|
|
18
|
-
codexSessionHookStatus,
|
|
19
17
|
codexSkillStatus,
|
|
20
18
|
installCodexProtectionHook,
|
|
21
|
-
installCodexSessionHook,
|
|
22
19
|
repositoryCodexSkills,
|
|
23
20
|
syncCodexSkills,
|
|
24
21
|
} from '../lib/codex-skills.mjs';
|
|
25
|
-
import { loadConfig } from '../lib/state.mjs';
|
|
26
|
-
|
|
27
|
-
const require = createRequire(import.meta.url);
|
|
28
|
-
const { refreshRegisteredCaseRules } = require('../../websocket-server/case-instructions.cjs');
|
|
29
22
|
|
|
30
23
|
export const meta = {
|
|
31
24
|
id: '09-codex-plugin',
|
|
32
25
|
label: 'Composants Codex PieceMaker',
|
|
33
|
-
description: 'Enregistre les skills et
|
|
26
|
+
description: 'Enregistre les skills et la protection des pièces lorsque la CLI Codex est présente',
|
|
34
27
|
required: false,
|
|
35
28
|
};
|
|
36
29
|
|
|
@@ -43,14 +36,10 @@ function dependencies(overrides = {}) {
|
|
|
43
36
|
userHome: os.homedir(),
|
|
44
37
|
log,
|
|
45
38
|
codexSkillStatus,
|
|
46
|
-
codexSessionHookStatus,
|
|
47
39
|
codexProtectionHookStatus,
|
|
48
|
-
installCodexSessionHook,
|
|
49
40
|
installCodexProtectionHook,
|
|
50
41
|
repositoryCodexSkills,
|
|
51
42
|
syncCodexSkills,
|
|
52
|
-
loadConfig,
|
|
53
|
-
refreshRegisteredCaseRules,
|
|
54
43
|
...overrides,
|
|
55
44
|
};
|
|
56
45
|
}
|
|
@@ -70,8 +59,6 @@ export async function install(ctx, overrides = {}) {
|
|
|
70
59
|
}
|
|
71
60
|
if (ctx.dryRun) {
|
|
72
61
|
ops.log.info(`[simulation] enregistrement de ${skills.length} skill(s) PieceMaker dans ~/.codex/skills`);
|
|
73
|
-
ops.log.info('[simulation] enregistrement du badge d’anonymisation au démarrage des sessions Codex');
|
|
74
|
-
ops.log.info('[simulation] actualisation des instructions AGENTS.md des dossiers enregistrés');
|
|
75
62
|
return { status: 'skipped', note: 'Mode simulation — aucune modification effectuée.' };
|
|
76
63
|
}
|
|
77
64
|
|
|
@@ -80,34 +67,21 @@ export async function install(ctx, overrides = {}) {
|
|
|
80
67
|
for (const conflict of result.conflicts) {
|
|
81
68
|
ops.log.warn(`Le skill Codex personnel « ${conflict.slug} » existe déjà et n'a pas été remplacé.`);
|
|
82
69
|
}
|
|
83
|
-
const sessionHook = ops.installCodexSessionHook(REPO_ROOT, ops.userHome);
|
|
84
|
-
if (!sessionHook.ok) {
|
|
85
|
-
ops.log.warn(`Badge d’anonymisation Codex non enregistré : ${sessionHook.reason}.`);
|
|
86
|
-
} else {
|
|
87
|
-
ops.log.detail(`Badge d’anonymisation Codex ${sessionHook.changed ? 'enregistré' : 'déjà à jour'} dans ~/.codex/hooks.json.`);
|
|
88
|
-
}
|
|
89
70
|
const protectionHook = ops.installCodexProtectionHook(REPO_ROOT, ops.userHome);
|
|
90
71
|
if (!protectionHook.ok) {
|
|
91
72
|
ops.log.warn(`Protection des pièces Codex non enregistrée : ${protectionHook.reason}.`);
|
|
92
73
|
} else {
|
|
93
74
|
ops.log.detail(`Protection des pièces Codex ${protectionHook.changed ? 'enregistrée' : 'déjà à jour'} dans ~/.codex/hooks.json.`);
|
|
94
75
|
}
|
|
95
|
-
|
|
96
|
-
ops.log.detail(`${instructions.refreshed} dossier(s) juridique(s) muni(s) des instructions Codex/Claude.`);
|
|
97
|
-
for (const failure of instructions.failed) {
|
|
98
|
-
ops.log.warn(`Instructions non actualisées pour ${failure.folder} : ${failure.error}`);
|
|
99
|
-
}
|
|
100
|
-
if (result.conflicts.length || !sessionHook.ok || !protectionHook.ok) {
|
|
76
|
+
if (result.conflicts.length || !protectionHook.ok) {
|
|
101
77
|
return {
|
|
102
78
|
status: 'partial',
|
|
103
|
-
note: !
|
|
104
|
-
? `Badge d’anonymisation Codex non enregistré (${sessionHook.reason}).`
|
|
105
|
-
: !protectionHook.ok
|
|
79
|
+
note: !protectionHook.ok
|
|
106
80
|
? `Protection des pièces Codex non enregistrée (${protectionHook.reason}).`
|
|
107
81
|
: `${result.conflicts.length} skill(s) Codex personnel(s) homonyme(s) conservé(s).`,
|
|
108
82
|
};
|
|
109
83
|
}
|
|
110
|
-
return { status: 'done', note: 'Skills
|
|
84
|
+
return { status: 'done', note: 'Skills PieceMaker disponibles à la prochaine session Codex CLI.' };
|
|
111
85
|
}
|
|
112
86
|
|
|
113
87
|
export async function check(_ctx, overrides = {}) {
|
|
@@ -130,10 +104,6 @@ export async function check(_ctx, overrides = {}) {
|
|
|
130
104
|
note: `${missing.length} skill(s) PieceMaker non enregistré(s) dans ~/.codex/skills.`,
|
|
131
105
|
};
|
|
132
106
|
}
|
|
133
|
-
const sessionHook = ops.codexSessionHookStatus(REPO_ROOT, ops.userHome);
|
|
134
|
-
if (!sessionHook.ok) {
|
|
135
|
-
return { status: 'partial', note: `Badge d’anonymisation Codex absent ou périmé (${sessionHook.reason}).` };
|
|
136
|
-
}
|
|
137
107
|
const protectionHook = ops.codexProtectionHookStatus(REPO_ROOT, ops.userHome);
|
|
138
108
|
if (!protectionHook.ok) {
|
|
139
109
|
return { status: 'partial', note: `Protection des pièces Codex absente ou périmée (${protectionHook.reason}).` };
|
|
@@ -4,9 +4,10 @@
|
|
|
4
4
|
* Reproduces, via the installer, a guard that previously only existed by
|
|
5
5
|
* hand under ~/.claude/ and would vanish on a fresh machine or a wiped
|
|
6
6
|
* ~/.claude: a `PreToolUse` hook that denies the *agent* any read of the
|
|
7
|
-
* server's `.env` et
|
|
8
|
-
* workarounds — cat/grep/head/`python -c "open(...)"`…), because
|
|
9
|
-
* holds Légifrance credentials
|
|
7
|
+
* server's `.env` et la base `auth.db` (Read/Grep/Glob/Edit/Write/NotebookEdit and Bash
|
|
8
|
+
* workarounds — cat/grep/head/`python -c "open(...)"`…), because the first
|
|
9
|
+
* holds Légifrance credentials and the second the real names behind every
|
|
10
|
+
* pseudonymisation code (`piecemaker_mappings`). See `installer/lib/secrets-guard.mjs` for
|
|
10
11
|
* the merge logic and `installer/assets/claude-hooks/
|
|
11
12
|
* piecemaker-guard-secrets.mjs` for the hook itself (a byte-for-byte copy of
|
|
12
13
|
* the one that was running standalone in ~/.claude/hooks).
|
|
@@ -31,7 +32,8 @@ import fs from 'node:fs';
|
|
|
31
32
|
import os from 'node:os';
|
|
32
33
|
import path from 'node:path';
|
|
33
34
|
import { log } from '../lib/ui.mjs';
|
|
34
|
-
import {
|
|
35
|
+
import { pathToFileURL } from 'node:url';
|
|
36
|
+
import { REPO_ROOT, GIT_REPO_ROOT } from '../lib/platform.mjs';
|
|
35
37
|
import { ENV_FILE } from '../lib/state.mjs';
|
|
36
38
|
import {
|
|
37
39
|
HOOK_SCRIPT_BASENAME,
|
|
@@ -48,18 +50,33 @@ import {
|
|
|
48
50
|
export const meta = {
|
|
49
51
|
id: '13-garde-secrets',
|
|
50
52
|
label: 'Garde-fou secrets (Claude Code)',
|
|
51
|
-
description: "Empêche Claude Code de lire le .env et
|
|
53
|
+
description: "Empêche Claude Code de lire le .env et la base auth.db (noms réels)",
|
|
52
54
|
};
|
|
53
55
|
|
|
54
|
-
|
|
56
|
+
async function databaseFiles() {
|
|
57
|
+
const upstreamRoot = path.join(os.homedir(), '.cloudcli');
|
|
58
|
+
let dataRoot = upstreamRoot;
|
|
59
|
+
try {
|
|
60
|
+
const { productDataRoot } = await import(pathToFileURL(path.join(GIT_REPO_ROOT, 'shared', 'product-config.mjs')).href);
|
|
61
|
+
dataRoot = productDataRoot(upstreamRoot);
|
|
62
|
+
} catch {
|
|
63
|
+
dataRoot = process.env.CLOUDCLI_HOME || upstreamRoot;
|
|
64
|
+
}
|
|
65
|
+
const database = process.env.DATABASE_PATH || path.join(dataRoot, 'auth.db');
|
|
66
|
+
return ['', '-wal', '-shm'].map((suffix) => `${database}${suffix}`);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
async function protectedPaths() {
|
|
70
|
+
return [ENV_FILE, ...await databaseFiles()];
|
|
71
|
+
}
|
|
55
72
|
|
|
56
73
|
export async function install(ctx) {
|
|
57
74
|
const userHome = os.homedir();
|
|
58
|
-
const
|
|
75
|
+
const guarded = await protectedPaths();
|
|
59
76
|
|
|
60
77
|
if (ctx.dryRun) {
|
|
61
78
|
log.info(`[simulation] hook installé/rafraîchi : ${hookTargetPath(userHome)} <- ${hookAssetPath(REPO_ROOT)}`);
|
|
62
|
-
log.info(`[simulation] liste noire créée/complétée : ${blocklistTargetPath(userHome)} (+${
|
|
79
|
+
log.info(`[simulation] liste noire créée/complétée : ${blocklistTargetPath(userHome)} (+${guarded.join(', ')})`);
|
|
63
80
|
log.info(`[simulation] ${settingsPath(userHome)} : hook PreToolUse + permissions.deny fusionnés`);
|
|
64
81
|
return { status: 'skipped', note: 'Mode simulation — aucune modification effectuée.' };
|
|
65
82
|
}
|
|
@@ -72,12 +89,12 @@ export async function install(ctx) {
|
|
|
72
89
|
if (hook.changed) log.ok(`Hook ${hook.created ? 'installé' : 'mis à jour'} : ${hook.path}`);
|
|
73
90
|
else log.ok(`Hook déjà à jour : ${hook.path}`);
|
|
74
91
|
|
|
75
|
-
const blocklist = seedBlocklist({ repoRoot: REPO_ROOT, userHome, envPaths:
|
|
92
|
+
const blocklist = seedBlocklist({ repoRoot: REPO_ROOT, userHome, envPaths: guarded });
|
|
76
93
|
if (blocklist.created) log.ok(`Liste noire créée : ${blocklist.path} (${blocklist.entries.length} chemin(s))`);
|
|
77
94
|
else if (blocklist.added.length) log.ok(`Liste noire complétée (+${blocklist.added.length}) : ${blocklist.path}`);
|
|
78
95
|
else log.ok(`Liste noire déjà à jour : ${blocklist.path}`);
|
|
79
96
|
|
|
80
|
-
const settings = mergeSettings({ userHome, envPaths:
|
|
97
|
+
const settings = mergeSettings({ userHome, envPaths: guarded });
|
|
81
98
|
if (settings.hookAdded) log.ok(`Hook PreToolUse enregistré dans ${settings.path}`);
|
|
82
99
|
else log.ok('Hook PreToolUse déjà enregistré.');
|
|
83
100
|
if (settings.denyAdded.length) log.ok(`Règle(s) permissions.deny ajoutée(s) : ${settings.denyAdded.join(', ')}`);
|
|
@@ -90,6 +107,7 @@ export async function install(ctx) {
|
|
|
90
107
|
|
|
91
108
|
export async function check(ctx) {
|
|
92
109
|
const userHome = os.homedir();
|
|
110
|
+
const guarded = await protectedPaths();
|
|
93
111
|
|
|
94
112
|
const hookOk = fs.existsSync(hookTargetPath(userHome));
|
|
95
113
|
|
|
@@ -99,7 +117,7 @@ export async function check(ctx) {
|
|
|
99
117
|
const normalized = new Set(Array.isArray(list)
|
|
100
118
|
? list.filter((entry) => typeof entry === 'string').map((entry) => path.resolve(entry))
|
|
101
119
|
: []);
|
|
102
|
-
blocklistOk =
|
|
120
|
+
blocklistOk = guarded.every((entry) => normalized.has(path.resolve(entry)));
|
|
103
121
|
} catch {
|
|
104
122
|
// absent or malformed -> not ok
|
|
105
123
|
}
|
|
@@ -118,7 +136,7 @@ export async function check(ctx) {
|
|
|
118
136
|
);
|
|
119
137
|
const deny = settings?.permissions?.deny;
|
|
120
138
|
denyOk = Array.isArray(deny)
|
|
121
|
-
&&
|
|
139
|
+
&& guarded.every((entry) => deny.includes(denyRuleFor(entry)));
|
|
122
140
|
} catch {
|
|
123
141
|
// absent or malformed -> not ok
|
|
124
142
|
}
|
|
@@ -33,7 +33,7 @@ Légifrance est maintenu séparément dans
|
|
|
33
33
|
|
|
34
34
|
L'installateur enregistre ces composants dans les emplacements utilisateur
|
|
35
35
|
découverts par les CLI. Il fusionne tous les hooks dans les réglages Claude
|
|
36
|
-
Code et la
|
|
36
|
+
Code et la protection des pièces (`PreToolUse`) dans les réglages Codex.
|
|
37
37
|
|
|
38
38
|
Chaque sous-dossier immédiat de `config.workspacePath` est traité comme un dossier
|
|
39
39
|
juridique indépendant. Son historique Git est conservé hors des données client,
|
|
@@ -56,8 +56,7 @@ L'étape `09-claude-assets` enregistre, si Claude Code est présent :
|
|
|
56
56
|
L'étape `09-codex-plugin` enregistre, si Codex CLI est présent :
|
|
57
57
|
|
|
58
58
|
- `~/.codex/skills/<slug>/SKILL.md`
|
|
59
|
-
- `~/.codex/hooks.json` —
|
|
60
|
-
proxy : `🔒 Anonymisation PieceMaker active ✓` ou un avertissement explicite.
|
|
59
|
+
- `~/.codex/hooks.json` — refus `PreToolUse` de lecture des pièces protégées.
|
|
61
60
|
|
|
62
61
|
Ce sont des **liens symboliques** vers `piecemaker-plugin/` : toute
|
|
63
62
|
modification du Markdown (administration ou éditeur) est prise en compte à la
|
|
@@ -80,12 +79,6 @@ Les hooks décrits par `hooks/hooks.json` sont fusionnés directement dans
|
|
|
80
79
|
dépendent donc d'aucun cache de plugin. `piecemaker update`, le démarrage du
|
|
81
80
|
serveur et l'étape 06 réconcilient cet enregistrement.
|
|
82
81
|
|
|
83
|
-
Codex ne permet pas encore d’exécuter une commande arbitraire dans sa
|
|
84
|
-
`tui.status_line`. PieceMaker utilise donc son hook natif `SessionStart` : le
|
|
85
|
-
message figure au début de chaque session et reflète le routage Codex ainsi que
|
|
86
|
-
la disponibilité du proxy au moment du lancement. Codex peut demander une fois
|
|
87
|
-
de confirmer la confiance accordée à ce hook local.
|
|
88
|
-
|
|
89
82
|
## Serveur MCP Légifrance
|
|
90
83
|
|
|
91
84
|
L'étape `07-legifrance` installe le plugin autonome depuis
|
|
@@ -37,7 +37,7 @@ import {
|
|
|
37
37
|
} from './lib/hook-io.mjs';
|
|
38
38
|
|
|
39
39
|
const require = createRequire(import.meta.url);
|
|
40
|
-
const {
|
|
40
|
+
const { locateProjectCase } = require('./lib/case-folders.cjs');
|
|
41
41
|
|
|
42
42
|
const DEFAULT_TIMEOUT_MS = 8000;
|
|
43
43
|
const MAX_TRANSCRIPT_BYTES = 10 * 1024 * 1024; // skip duration/tool-count derivation beyond this
|
|
@@ -106,10 +106,10 @@ function derivedDurationMs(analysis) {
|
|
|
106
106
|
return Number.isFinite(ms) && ms >= 0 ? ms : null;
|
|
107
107
|
}
|
|
108
108
|
|
|
109
|
-
/** Name of the
|
|
110
|
-
function detectDossier(cwd
|
|
109
|
+
/** Name of the project folder containing cwd. */
|
|
110
|
+
function detectDossier(cwd) {
|
|
111
111
|
if (!cwd) return null;
|
|
112
|
-
return
|
|
112
|
+
return locateProjectCase(cwd)?.caseName || null;
|
|
113
113
|
}
|
|
114
114
|
|
|
115
115
|
function synthesisFilePath(sessionId, isoTimestamp) {
|
|
@@ -133,7 +133,7 @@ async function main() {
|
|
|
133
133
|
|
|
134
134
|
const nowIso = new Date().toISOString();
|
|
135
135
|
const monthFile = path.join(BILLING_DIR, `${nowIso.slice(0, 7)}.jsonl`); // YYYY-MM.jsonl
|
|
136
|
-
const dossier = detectDossier(payload.cwd
|
|
136
|
+
const dossier = detectDossier(payload.cwd);
|
|
137
137
|
const analysis = await analyzeTranscript(payload.transcript_path);
|
|
138
138
|
|
|
139
139
|
if (eventName === 'TaskCompleted') {
|
|
@@ -3,12 +3,12 @@
|
|
|
3
3
|
* PostToolUse hook (Write|Bash) — classe en « espace de travail » tout document
|
|
4
4
|
* que l'IA vient de créer dans un dossier juridique enregistré.
|
|
5
5
|
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
6
|
+
* Seuls les PDF et les images sont protégés, et `.piecemaker/protection.json`
|
|
7
|
+
* n'enregistre que les exceptions. Sans ce hook, un PDF ou une image produits
|
|
8
|
+
* par l'IA elle-même — export pandoc/LibreOffice, rendu d'une note de
|
|
9
|
+
* recherche — naît protégé, et le `PreToolUse` `protect-originals.mjs` lui en
|
|
10
|
+
* refuse ensuite la relecture. Il n'y a pourtant rien à protéger de l'IA dans
|
|
11
|
+
* un fichier qu'elle a écrit.
|
|
12
12
|
*
|
|
13
13
|
* Le classement reste une *exception ajoutée* : rien de ce que l'IA n'a pas
|
|
14
14
|
* nommé n'est déclassé, et une pièce marquée « ressource » n'est jamais
|
|
@@ -30,7 +30,7 @@ import {
|
|
|
30
30
|
|
|
31
31
|
const require = createRequire(import.meta.url);
|
|
32
32
|
const { classifyAsWorkspace } = require('./lib/protection.cjs');
|
|
33
|
-
const {
|
|
33
|
+
const { locateProjectCase } = require('./lib/case-folders.cjs');
|
|
34
34
|
|
|
35
35
|
/**
|
|
36
36
|
* Une commande Bash ne dit pas quel fichier elle a créé. On ne retient donc
|
|
@@ -110,7 +110,7 @@ async function main() {
|
|
|
110
110
|
for (const absolute of candidatePaths(payload, cwd)) {
|
|
111
111
|
let located;
|
|
112
112
|
try {
|
|
113
|
-
located =
|
|
113
|
+
located = locateProjectCase(absolute);
|
|
114
114
|
} catch {
|
|
115
115
|
continue;
|
|
116
116
|
}
|
|
@@ -28,7 +28,7 @@ import {
|
|
|
28
28
|
|
|
29
29
|
const require = createRequire(import.meta.url);
|
|
30
30
|
const { locateCaseFile } = require('./lib/commits.cjs');
|
|
31
|
-
const {
|
|
31
|
+
const { locateProjectCase } = require('./lib/case-folders.cjs');
|
|
32
32
|
|
|
33
33
|
const PENDING_DIR = path.join(HOME_DIR, 'pending');
|
|
34
34
|
|
|
@@ -50,7 +50,7 @@ async function main() {
|
|
|
50
50
|
const absolute = path.isAbsolute(filePath) ? filePath : path.resolve(cwd, filePath);
|
|
51
51
|
let located;
|
|
52
52
|
try {
|
|
53
|
-
const configured =
|
|
53
|
+
const configured = locateProjectCase(absolute);
|
|
54
54
|
if (!configured) return null;
|
|
55
55
|
located = locateCaseFile(configured.casesRoot, absolute);
|
|
56
56
|
} catch {
|
|
@@ -21,15 +21,14 @@ import fs from 'node:fs';
|
|
|
21
21
|
import path from 'node:path';
|
|
22
22
|
import {
|
|
23
23
|
HOME_DIR,
|
|
24
|
-
loadPieceMakerConfig,
|
|
25
24
|
noop,
|
|
26
25
|
readHookPayload,
|
|
27
26
|
runHook,
|
|
28
27
|
} from './lib/hook-io.mjs';
|
|
29
28
|
|
|
30
29
|
const require = createRequire(import.meta.url);
|
|
31
|
-
const {
|
|
32
|
-
const {
|
|
30
|
+
const { locateProjectCase } = require('./lib/case-folders.cjs');
|
|
31
|
+
const { resolveProjectCaseMapping, revertMapping } = require('./lib/mapping.cjs');
|
|
33
32
|
const { renderMarkdown, reportSlug } = require('./lib/recherche-report.cjs');
|
|
34
33
|
|
|
35
34
|
const HERE = path.dirname(fileURLToPath(import.meta.url));
|
|
@@ -62,10 +61,9 @@ async function main() {
|
|
|
62
61
|
|
|
63
62
|
// Le cas cible est porté par le payload (l'agent sait dans quel dossier il
|
|
64
63
|
// travaille) : un chemin absolu situé dans le dossier enregistré.
|
|
65
|
-
const config = loadPieceMakerConfig();
|
|
66
64
|
const caseHint = data.caseRoot || data.case || data.dossier;
|
|
67
65
|
if (!caseHint || !path.isAbsolute(caseHint)) return null;
|
|
68
|
-
const located =
|
|
66
|
+
const located = locateProjectCase(caseHint);
|
|
69
67
|
if (!located) return null;
|
|
70
68
|
|
|
71
69
|
const rechercheDir = path.join(located.caseRoot, 'recherche');
|
|
@@ -77,7 +75,7 @@ async function main() {
|
|
|
77
75
|
// lisible → on ré-identifie le Markdown final avant écriture disque (même
|
|
78
76
|
// logique que commit-track sur les libellés). Idempotent.
|
|
79
77
|
let markdown = renderMarkdown(data, { caseName: located.caseName });
|
|
80
|
-
const legalCase =
|
|
78
|
+
const legalCase = resolveProjectCaseMapping(located.caseRoot);
|
|
81
79
|
if (legalCase?.reverse_mapping) markdown = revertMapping(markdown, legalCase.reverse_mapping);
|
|
82
80
|
|
|
83
81
|
fs.mkdirSync(rechercheDir, { recursive: true });
|